Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Macro to add three seperate groups

I have a worksheet that has over 1,000 rows with no labels. The first three
columns have the same labels. Here is what I would like to do:

I would like to create 3(three) worksheets by picking the following:

1St group (tab) would include rows 1, 4, 7, 10, 13 etc. adding the 3rd row
to the end.

2nd group (tab) would include rows 2, 5, 8, 11, 14, etc. adding the 3rd row
to the end

3rd group (tab) would include rows 3, 6, 9, 12, etc. adding the 3rd row to
the end.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to add three seperate groups

This code is very simple, but works.

"Beep Beep" wrote:

I have a worksheet that has over 1,000 rows with no labels. The first three
columns have the same labels. Here is what I would like to do:

I would like to create 3(three) worksheets by picking the following:

1St group (tab) would include rows 1, 4, 7, 10, 13 etc. adding the 3rd row
to the end.

2nd group (tab) would include rows 2, 5, 8, 11, 14, etc. adding the 3rd row
to the end

3rd group (tab) would include rows 3, 6, 9, 12, etc. adding the 3rd row to
the end.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to add three seperate groups

This code is very simple, but work extremely well


Sub move_rows()

Set MasterSheet = ActiveSheet
With MasterSheet
Lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For movesheet = 3 To 1 Step -1
MoveRowCount = 1
Worksheets.Add after:=Worksheets(.Index)
'newworksheet is now actrive sheet
For RowCount = movesheet To Lastrow Step 3
.Rows(RowCount).Copy Destination:=ActiveSheet.Rows(MoveRowCount)
MoveRowCount = MoveRowCount + 1
Next RowCount
Next movesheet
End With
End Sub
"Beep Beep" wrote:

I have a worksheet that has over 1,000 rows with no labels. The first three
columns have the same labels. Here is what I would like to do:

I would like to create 3(three) worksheets by picking the following:

1St group (tab) would include rows 1, 4, 7, 10, 13 etc. adding the 3rd row
to the end.

2nd group (tab) would include rows 2, 5, 8, 11, 14, etc. adding the 3rd row
to the end

3rd group (tab) would include rows 3, 6, 9, 12, etc. adding the 3rd row to
the end.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Macro to add three seperate groups

Thanks Joel:

Worked like a charm

"Joel" wrote:

This code is very simple, but work extremely well


Sub move_rows()

Set MasterSheet = ActiveSheet
With MasterSheet
Lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For movesheet = 3 To 1 Step -1
MoveRowCount = 1
Worksheets.Add after:=Worksheets(.Index)
'newworksheet is now actrive sheet
For RowCount = movesheet To Lastrow Step 3
.Rows(RowCount).Copy Destination:=ActiveSheet.Rows(MoveRowCount)
MoveRowCount = MoveRowCount + 1
Next RowCount
Next movesheet
End With
End Sub
"Beep Beep" wrote:

I have a worksheet that has over 1,000 rows with no labels. The first three
columns have the same labels. Here is what I would like to do:

I would like to create 3(three) worksheets by picking the following:

1St group (tab) would include rows 1, 4, 7, 10, 13 etc. adding the 3rd row
to the end.

2nd group (tab) would include rows 2, 5, 8, 11, 14, etc. adding the 3rd row
to the end

3rd group (tab) would include rows 3, 6, 9, 12, etc. adding the 3rd row to
the end.




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
add two cells from seperate work sheets into a cell on seperate wo lar Excel Worksheet Functions 6 April 27th 10 06:54 PM
Deleting groups of rows when using a macro recording? Paul Excel Discussion (Misc queries) 1 February 6th 09 04:55 PM
Excel - Sorting groups in groups due to subtotaling [email protected] Excel Worksheet Functions 3 April 4th 08 06:13 PM
Macro for sorting within groups Arjun Excel Programming 4 June 12th 06 04:49 PM
how do i view all groups under excel in google groups JulieD Excel Discussion (Misc queries) 2 December 16th 04 04:33 PM


All times are GMT +1. The time now is 12:30 AM.

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

About Us

"It's about Microsoft Excel"