title: Using VBA to Add Rows based on a cell value onto another worksheet
body: <p>I am trying to create a spreadsheet whereby I have a value in a cell in a worksheet called "Equipment" cell C5, for example a Value of 4.</p>
  
  <p><a href="http://i.stack.imgur.com/sfQQW.png" rel="nofollow">Starting Cell Image</a></p>
  
  <p>I need to use this value to copy a section of the same row (D5:M5) and paste it that many times into a worksheet called "Programming" also if this changes I would like it to delete or add where required, ignoring where there is a blank or 0 value in the "equipment" sheet</p>
  
  <p><a href="http://i.stack.imgur.com/7y1pF.png" rel="nofollow">Desired Result</a></p>
  
  <p>I have around 30 different items and all will have different sections to copy but they will be of the same size. Also Could this look down a list of values all in the same column and do the same for all the values</p>
  
  <p>I'm very new to VBA and have managed to hide and show tabs based on values but i'm struggling to get my head around this as it's a little too complicated at this point.</p>
  
  <p>Thank You in advance</p>
  
  <p>Lee</p>
  
  <p>This is what I have so far, I have edited the code to what I believe is correct but it still isn't working</p>
  
  <pre><code>Sub copySheetCells()
  
  'loop by each cell in column "C"
  For i = 2 To Sheets("Equipment").Cells(Rows.Count, "C").End(xlUp).Row
      'repeat copy x times (based on cell in column "C" value)
      For j = 0 To (Sheets("Equipment").Cells(i, "C").Value - 1)
          'define source range
          Source = "D" &amp; (i) &amp; ":M" &amp; (i)
          'find last row on second sheet
          lastRowS2 = Sheets("Hardware_Programming").Cells(Rows.Count, "A").End(xlUp).Row
          'copy data
      Sheets("Equipment").Range(Source).copy Destination:=Sheets("Hardware_Programming").Range("A" &amp; lastRowS2 + 1)
  Next j
  Next i
  'copy headers
  Sheets("Equipment").Range("D1:M1").copy Destination:=Sheets    ("Hardware_Programming").Range("A1:J1")
  End Sub
  </code></pre>
  
  <p>I only get blank spaces, is anyone able to advise any further?</p>