ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to add three seperate groups (https://www.excelbanter.com/excel-programming/400611-macro-add-three-seperate-groups.html)

Beep Beep

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.





joel

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.





joel

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.





Beep Beep

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.






All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com