Extracting certain rows from data

  • Thread starter Thread starter Steve Battles
  • Start date Start date
S

Steve Battles

I have a 4 column/4000 row spreadsheet. I need to extract the data on
only every 10th row. So I need 10, 20, 30, 40, 50, etc. I don't care
if the data is on the same spreadsheet, or on another one. I just
can't figure out how to do it. Anyone up for the challenge? All help
is appreciated.
 
This example will copy the rows to a sheet with the name Sheet2

Sub copytest()
Dim R As Long
Dim rng As Range
For R = 10 To 100 Step 10
Set rng = Sheets("sheet2").Range("A" & Rows.Count). _
End(xlUp).Offset(1, 0)
Rows(R).Copy rng
Next R
End Sub
 
Use this if the cell in Column A don't always have a value

Sub copytest2()
Dim R As Long
Dim rng As Range
Dim rownum As Long
rownum = 0
For R = 10 To 100 Step 10
rownum = rownum + 1
Set rng = Sheets("sheet2").Range("A" & rownum)
Rows(R).Copy rng
Next R
End Sub
 
Back
Top