View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Zone[_3_] Zone[_3_] is offline
external usenet poster
 
Posts: 373
Default select for choosing

Johnathan, my math was a little off! Beginning with row 1 and skipping 5
each time would copy row 1,6,11, and so on. Is that what you want? The
following code copies from Sheet1 and pastes in Sheet2. Copy this code and
paste in a standard module and see if it does what you want. James

Sub CopyEvery5th()
Dim j As Long, k As Long, BtmRow As Long
Worksheets("Sheet2").Cells.Clear
Worksheets("Sheet1").Activate
BtmRow = Cells(Rows.Count, "a").End(xlUp).Row
k = 1
For j = 1 To BtmRow Step 5
Rows(j).EntireRow.Copy Destination:=Worksheets("Sheet2").Cells(k,
"a")
k = k + 1
Next j
End Sub

"Jonathan" wrote in message
...
Yes, exactly.

"Zone" wrote:

Do you mean you want to copy row 1 to another sheet, skip rows 2-4, copy
row
5 to the next row on the other sheet, skip rows 6-9, copy row 10, and so
on?

"Jonathan" wrote in message
...
Dear guys, I have a small urgent problem.

I have more than 10000 lines of data in one spreadsheet. I am trying to
select the lines in every 5 lines in this sheet and copy it to another.

at early stage of learning VB, and really couldnt find the right way.

Thx