title: Excel Get All Multiples Of Column A & B If For Similar value of column C
body: <p>How Would you add a condition so the value of column B and C only repeat depending on value of column C. </p>
  
  <pre><code>Height Width Project
  400    200   Alpha
  500    300
  700
  800
  1000    200   Beta
  5000    900
  6500    420
  760
  890
  </code></pre>
  
  <p>I am after something that's all multiples of column A &amp; B for project alpha. Then all multiples of Column A &amp; B for project Beta.</p>
  
  <pre><code>400    200   Alpha
  500    200   Alpha
  600    200   Alpha
  700    200   Alpha
  800    200   Alpha
  400    300   Alpha
  500    300   Alpha
  600    300   Alpha
  700    300   Alpha
  800    300   Alpha
  1000   200   Beta
  5000   200   Beta
  ...
  </code></pre>
  
  <p>So far I have this sub that gives me all multiples of column A &amp; B</p>
  
  <pre><code>    Sub loops()
  
  Dim n_height, n_width, c As Integer
  
  With ThisWorkbook.Sheets("Sheet1")
  
  n_height = .Cells(Rows.Count, 1).End(xlUp).Row 'Assuming height is in column A
  n_width = .Cells(Rows.Count, 2).End(xlUp).Row 'Assuming width is in column B
  
  c = 2
  
  For i = 2 To n_height
      For j = 2 To n_width
          .Range("D" &amp; c).Value = .Range("A" &amp; i).Value 'Prints heights in column D
          .Range("E" &amp; c).Value = .Range("B" &amp; j).Value 'Prints widths in column E
          c = c + 1
      Next j
  Next i
  
  End With
  
  End Sub
  </code></pre>
  
  <p>I need a condition adding to this that value only repeat depending on column C value.</p>