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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,521
Messages
6,114,104
Members
448,548
Latest member
harryls

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