View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_23_] Stuart[_23_] is offline
external usenet poster
 
Posts: 5
Default Copy every nth row into a new worksheet

Sub copyNthRow()
Dim j As Integer
Dim i As Integer
Dim NthRow As Integer

NthRow = 5
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


If all your stuff is on "Sheet1" then the above sub will copy every 5th row
to "sheet 2"

just change the variable "NthRow" to what ever you need





"Hal" wrote in message
...
I have a worksheet that contains 30000 rows of data plus tow header rows.

I
want to copy every nth row into a new worksheet.

Any suggestions on how to program this are greatly appreciated.

Hal