copy & past text every30th Row into new sheet

Joined
May 30, 2011
Messages
4
Reaction score
0
The below code I found in this forum works almost perfect for what I am looking for. I have 3 columns Dates, Times, Values. it is about 8600 rows. I need these rows by every 30th rows. This code work for me but when it get to the last row it keeps going. I need it to stop and the first blank line it sees after its counted all the lines.

Please help, and thanks for helping me.:confused:

The Code:
---------------------------------------

Sub copyNthRow()

Dim j As Long
Dim i As Long
Dim NthRow As Integer
NthRow = 30
j = Cells.SpecialCells(xlLastCell).Row
Range("A1").Select
Do Until ActiveCell.Row > j
Rows(ActiveCell.Row).Copy
Sheets("Sheet2").Range("A1").Offset(i, 0).PasteSpecial (xlValues)
i = i + 1
ActiveCell.Offset(NthRow, 0).Select

Loop
End Sub
 
Back
Top