List of Values to Create New Sheets

MrT82

Board Regular
Joined
Dec 12, 2005
Messages
84
Hi All,

Just getting into Macros etc.

Can anyone provide me with a macro or tell me if it's possible to do this..

If I have a sheet called 'Look' with a series of six digit numbers in column A is there a macro that I can run that will create a new sheet for each value in column A and rename it accordingly? Presumably the length of column A shall not go over 20 as I believe that this is the maximum number of sheets that Excel shall allow?

Any ideas one and all would be greatly appreciated! :biggrin:

Thanks,

Paul
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

kmiles

Board Regular
Joined
Apr 1, 2002
Messages
113
This should do it, edit range for number of cells to create worksheets for. You can have as many worksheets in one book as your memory can hold.


Sub create_worksheets_from_col_values()

Dim c As Range, ws As Worksheet, ns As Worksheet, new_name As Variant

Set ws = ActiveSheet

For Each c In ws.Range("A1:A15")
new_name = Left(c, 25) ' keep the worksheet name reasonable

On Error Resume Next
Set ns = Worksheets(new_name)
If ns Is Nothing Then
Sheets.Add().Name = new_name
ws.Activate
End If
Next

End Sub
 

MrT82

Board Regular
Joined
Dec 12, 2005
Messages
84
That is superb! Thank you, just what the Doctor ordered!

Thanks,

Paul

:biggrin:
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,351
Office Version
  1. 365
Platform
  1. Windows
Paul

I see you have started a new thread.:)

There isn't actually a limit to the number of worksheets.
Code:
For I = 1 to 1000
    Worksheets.Add
Next I
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,836
Messages
5,855,912
Members
431,774
Latest member
WillWilco

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
Top