View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Anant Basant Anant Basant is offline
external usenet poster
 
Posts: 30
Default How to move every nth value in a column

Hi,

Please try this macro.

Sub Move_Every_Fifth()
Dim LastRow As Long, LastRowDestSheet As Long
Dim i As Long, srcSht As Worksheet
Dim DestSht As Worksheet

Set srcSht = ActiveSheet
Set DestSht = Sheets("Sheet2")
LastRow = srcSht.Cells(Rows.Count, 1).End(xlUp).Row

For i = 1 To LastRow Step 5
If i = 1 Then
LastRowDestSheet = DestSht.Cells(DestSht.Rows.Count, 1).End(xlUp).Row
Else
LastRowDestSheet = DestSht.Cells(DestSht.Rows.Count,
1).End(xlUp).Row + 1
End If
DestSht.Cells(LastRowDestSheet, 1).Value = Cells(i, 1).Value
Next i
End Sub

If you need any help with this please revert.

--
Anant


" wrote:

How can I move every 5th value in a column of data to another
worksheet? Also, Is it possible to define a start/stop point for this?
Any help is greatly appreciated.