Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to move every nth value in a column

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to move every nth value in a column

This can be done without VBA:

In a helper column near your dta enter:

=MOD(ROW(),5) and copy down. You should see a sequence like:

2
3
4
0
1
2
3
4
0
1
2
3
etc. (not necessarily starting with 2).

Then switch on AutoFilter. You can then select every fifth line for
copy/paste with arbitrary phasing.
--
Gary's Student


" 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
numbers in a column and it changes when I move to the next column confused Excel Discussion (Misc queries) 1 August 5th 06 04:46 AM
how to move the cursor to column A after entering data column F tskaiser New Users to Excel 2 April 29th 06 02:28 PM
move contents of column C based on criteria related to column A Debra Excel Discussion (Misc queries) 2 December 27th 05 10:25 PM
move column headings from row to column EducatingMom Excel Worksheet Functions 1 June 3rd 05 05:06 PM
Move Cell in Column A to Column B when FIND juan Excel Programming 2 April 6th 04 10:20 PM


All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"