Auto Create & Rename Multiple Sheets With Just A Click
Click here for sample File (Download and open in msexcel as it will not work in google sheets)
Copy Below Code and paste it under module:
Sub InsertMultipleSheets()
Dim x As String
Dim ShCnt As Integer
Dim myarray() As String
Dim i As Integer
Dim Lrow As Integer
x = InputBox("Enter number of sheets to insert.", "Enter Multiple Sheets")
If x = NullString Then
Exit Sub
End If
Sheets.Add After:=ActiveSheet, Count:=x
Sheets("Main").Select
Range("A1").Select
Lrow = Range("A1").End(xlDown).Row
ShCnt = ThisWorkbook.Sheets.Count
ReDim myarray(1 To Lrow)
For i = 1 To UBound(myarray)
myarray(i) = Range("A" & i).Value
Next i
For i = 1 To ShCnt
Sheets(i).Name = myarray(i)
Next i
MsgBox "Sheets created and renamed successfully"
End Sub
No comments:
Post a Comment