Hello! Hoping someone can help with this, I'm sure it's something simple but I'm lost...
I have the below code which will create a number of new worksheets based off the numerical value in cell G28, this part is working fine.
What I'd like it to do next is to name each worksheet "Connector 1", "Connector 2", etc until all worksheets are named up to the value in G28.
I've commented out where I started playing around to see what happened (I didn't get far) and I understand that second part of the 'sheet_name' string wont work (it counts down rows from G28 and names the sheets with the values found in those cells).
Sub AddConnectorSheets()
Dim sheets_count As Integer
Dim sheet_name As String
'Dim sheet_number As Integer
Dim i As Integer
sheet_count = Sheets("Home").Range("G28").value
'sheet_number = Sheets("Home").Range("G28").value
For i = 1 To sheet_count
'sheet_name = "Connector " & sheet_number
sheet_name = "Connector " & Sheets("Home").Range("G28").Cells(i, 1).value
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = sheet_name
Next i
End Sub
Thanks for reading!
I have the below code which will create a number of new worksheets based off the numerical value in cell G28, this part is working fine.
What I'd like it to do next is to name each worksheet "Connector 1", "Connector 2", etc until all worksheets are named up to the value in G28.
I've commented out where I started playing around to see what happened (I didn't get far) and I understand that second part of the 'sheet_name' string wont work (it counts down rows from G28 and names the sheets with the values found in those cells).
Sub AddConnectorSheets()
Dim sheets_count As Integer
Dim sheet_name As String
'Dim sheet_number As Integer
Dim i As Integer
sheet_count = Sheets("Home").Range("G28").value
'sheet_number = Sheets("Home").Range("G28").value
For i = 1 To sheet_count
'sheet_name = "Connector " & sheet_number
sheet_name = "Connector " & Sheets("Home").Range("G28").Cells(i, 1).value
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = sheet_name
Next i
End Sub
Thanks for reading!