excel - copy function - 2007

December 14, 2009 at 15:49:04
Specs: Windows XP
I would like to take my database that is on 200 consecutive rows and a create a table of sorts that is spaced out every 4 rows. my data base changes so i need equations associated with them to manipulate the the base data. is it possible to use a function to do this where I would not have to manually change the cell reference each time. Is it possible to copy a row to a different row, but incremented. for instance sheet 1, row 3, to sheet 2, Row 7, thence sheet 1 row 4 to sheet 2 Row 11, thensheet 1 row 5 to sheet 2 Row 15, thence sheet 1 row 6 to sheet 2 Row 19, thence sheet 1 row 7 to sheet 2 Row 23, and so on...

Thanks Richard


See More: excel - copy function - 2007

Report •


#1
December 15, 2009 at 03:59:09
This might help...

Sub CopyIncrementsRow()
 Dim orgRow, lastRow, newRow, copyRow
 'First row of data on Sheet 1
   orgRow = 3
 'Last row of data on Sheet 1
   lastRow = Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
 'Initialze row variable for Sheet 2
   newRow = 7
 'Copy each row from Sheet 1 to Sheet 2
    For copyRow = orgRow To lastRow
       Range("A" & copyRow).EntireRow.Copy _
         Destination:=Sheets(2).Range("A" & newRow)
 'Increment row variable for Sheet 2
        newRow = newRow + 4
    Next
End Sub


Report •
Related Solutions


Ask Question