Thread: Excel template
View Single Post
 
Old 01-15-2025, 09:01 AM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Sorry about that. Believe it or not, my old eyes didn't see that variable.

Code:
Option Explicit

Sub mkeShs()

Dim i As Integer
Dim Name As String
Name = "Test-"
Application.CopyObjectsWithCells = False

For i = 1 To 11
Sheets("SH-1").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Name & i
Next i
Application.CopyObjectsWithCells = True 'reset
End Sub
The previous macro didn't start at the number you were hoping for because 3 sheets already existed. So vba began with the next number after the already existing number of sheets.
Reply With Quote