title: Copy/Paste n Times Based on Other Cell Values
body: <p>I've run in to a wall with this. Despite posts on SO like <a href="https://stackoverflow.com/questions/9099103/excel-2007-vba-copy-rows-x-times-based-on-text-filter">this one</a> that is <em>very</em> similar or <a href="http://en.kioskea.net/forum/affich-107673-copy-row-and-insert-n-times" rel="nofollow noreferrer">this one</a> on Kioskea, I just cannot connect the dots in my head between filtering cells and copying based on a formula result that's needed to make this work. Here is the data table - simplified - I am working with:</p>
  
  <pre><code>     A    B   C        D     E      F    G    H
   R1 Name Num Status   #Orig #InPro #Act #Rem #RemStatus
   R2 ABC  032 Complete 22    0      11   11   Purged
   R3 LMN  035 In Prog  25    21     4    21   Pending Scan
   R4 XYZ  039 Not Act  16    16     0    16   Not Active
  </code></pre>
  
  <p>This depicts the status of boxes of paper files and their disposition:</p>
  
  <ul>
  <li>Column D is the number of boxes planned to be scanned</li>
  <li>Column E is the number of boxes out for scanning</li>
  <li>Column F is the number of boxes actually scanned</li>
  </ul>
  
  <p>Column G and H can have three meanings, based on status:</p>
  
  <ul>
  <li>If the status is Not Active, Column G and H match it, and nothing needs to be done</li>
  <li>If the status is In Progress, it is assumed the number in Column G is the number of boxes pending scanning (simply original minus actual)</li>
  <li>If the status is Complete, it is assumed the number in Column G is the number of boxes that did not need to be scanned and were Purged</li>
  </ul>
  
  <p>What my code (shown below) is supposed to do is iterate through each row in a range (A2:H61). If the status is Not Active the row can be ignored and it moves on to the next row. If the status is In Progress or Complete, the macro, in whatever row it's 'reading', needs to copy cells A, B, and H and paste it (column)"G" number of times in another worksheet - within the same workbook - starting in the next available row. <em>Deep breath</em></p>
  
  <p>I know. It hurts my brain, too. Here is the code I have so far:</p>
  
  <pre><code>Sub TEST_Copy_Process()
  
  Dim srcrange As Range
  Dim wb As Workbook
  Dim ws1 As Worksheet, ws2 As Worksheet
  
  Set wb = ActiveWorkbook
  Set ws1 = Worksheets("SIS Agregate")
  Set ws2 = Worksheets("Center Detail")
  Set srcrange = Range(wb.ws2.Cells("A2:H61"))
  
  
  For Each Row In srcrange.Rows
  
  If Row = "Not Active" And Row.Offset(0, 3) = SectorType Then
  Continue
  ElseIf Row = "In Progress" And Row.Offset(0, 3) = SectorType Then
  
  ElseIf Row = "Complete" And Row.Offset(0, 3) = SectorType Then
  
  End If
  
      Set LastCell = wb.ws1.Cells(wb.ws1.Rows.Count, "A").End(xlUp)
      LastCellRowNumber = LastCell.Row + 1
  
  Next Row
  
  End Sub
  </code></pre>
  
  <p>Once I get to the code that is actually doing the grunt-work, I don't have the knowledge to sort out which is best. As noted above, posts like <a href="https://stackoverflow.com/questions/9099103/excel-2007-vba-copy-rows-x-times-based-on-text-filter">this</a> have helpd get me here. And I am slowly starting to make sense of what I found on <a href="http://www.mrexcel.com/forum/excel-questions/679795-visual-basic-applications-each-row-table-each-statement-help.html" rel="nofollow noreferrer">Mr. Excel</a>. This person seems to be doing the If/Then work but I don't understand how it's copying or pasting.</p>
  
  <p>I appreciate any and all help. Even if you can point me to a resource that will help explain this a bit (besides books on Amazon :] ) it would be a great help!</p>