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
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

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,047
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,071
Messages
5,570,023
Members
412,304
Latest member
citrus
Top