ststern45
Well-known Member
- Joined
- Sep 17, 2005
- Messages
- 961
- Office Version
- 365
- 2010
- Platform
- Windows
Hello everyone,
I would like to create 100 new worksheets and number them 000 through 099.
I have the following code but need to add or create code that have the format "000"
Thank you in advance!!
I would like to create 100 new worksheets and number them 000 through 099.
I have the following code but need to add or create code that have the format "000"
Thank you in advance!!
VBA Code:
Sub CreateWorksheets(Names_Of_Sheets As Range)
Dim No_Of_Sheets_to_be_Added As Integer
Dim Sheet_Name As String
Dim i As Integer
No_Of_Sheets_to_be_Added = Names_Of_Sheets.Rows.Count
For i = 1 To No_Of_Sheets_to_be_Added
Sheet_Name = Names_Of_Sheets.Cells(i, 1).Value
'Only add sheet if it doesn't exist already and the name is longer than zero characters
If (Sheet_Exists(Sheet_Name) = False) And (Sheet_Name <> "") Then
Worksheets.Add().Name = Sheet_Name
End If
Next i
End Sub