Copy and Create New Worksheet Tabs from Column Values

wazzulu1

Board Regular
Joined
Oct 4, 2006
Messages
164
Hi;

Is it possible to create new worksheet tabs in a worksheet, based off of column values, say in column G.

So that a macro would look through column G, and create a tab for each unique value, then copy the rows from column A:AS to the new sheet that is associated with that value?

I'm still a newbie needing help.

Thanks!
 
Hi

What is the name of the sheet that contains the Column G data you are using?


Tony
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi

Ok, then where I have referenced sheet1 you will have to modify the code to be Customer File.

Tony
 
Upvote 0
Hi;another question:

Is there a way to have a step to copy rows 1 to 10 from another worksheet called "Sales Quota", and insert them at the top of the newly created worksheets in this code below?

I'm trying to put headers into the spreadsheets.

Sub ccc()
Set dic = CreateObject("scripting.dictionary")
For Each ce In Range("G1:G" & Cells(Rows.Count, "G").End(xlUp).Row)
If Not dic.exists(ce.Value) Then
dic.Add ce.Value, ce.Value
Sheets.Add after:=Worksheets(Sheets.Count)
ActiveSheet.Name = ce.Value
Range("A1").Resize(1, 45).Value = Sheets("Sys Dump").Cells(ce.Row, 1).Resize(1, 45).Value
Else
With Sheets(ce.Value)
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 45).Value = Sheets("Sys Dump").Cells(ce.Row, 1).Resize(1, 45).Value
End With
End If
Next ce

End Sub
 
Upvote 0
Hi

Try this.

Code:
Sub ccc()
Set dic = CreateObject("scripting.dictionary")
For Each ce In Range("G1:G" & Cells(Rows.Count, "G").End(xlUp).Row)
If Not dic.exists(ce.Value) Then
dic.Add ce.Value, ce.Value
Sheets.Add after:=Worksheets(Sheets.Count)
ActiveSheet.Name = ce.Value
Range("A1:AS10").Value = Sheets("Sales Quota").Range("A1:AS10").Value
Range("A11").Resize(1, 45).Value = Sheets("Sys Dump").Cells(ce.Row, 1).Resize(1, 45).Value
Else
With Sheets(ce.Value)
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 45).Value = Sheets("Sys Dump").Cells(ce.Row, 1).Resize(1, 45).Value
End With
End If
Next ce

End Sub


HTH

Tony
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,862
Members
449,052
Latest member
Fuddy_Duddy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top