Macro to Add Multiple Sheets in Excel


Add a new Worksheet


Sub AddNewSheet()
Sheets.Add
End Sub

Add two new Worksheets into a Workbook


Sub AddMultipleSheets()
Call Sheets.Add(, , 2)
End Sub

Add Worksheets based on user input


Sub AddSheetsUserInput()
Dim i, j As Integer
i = Val(InputBox(“Enter the number of sheets to be added”))
For j = 1 To i
Worksheets.Add
Next j
End Sub

Add and Name the Worksheets based on User Input


Sub AddAndNameWorksheets()
Dim i, j As Integer
i = Val(InputBox(“Enter the number of sheets to be added”))
For j = 1 To i
Worksheets.Add.Name = “XL n CAD ” & j
Next j
End Sub

Create worksheets from the names present in a Worksheet


Sub CreateSheetsUsingNames()
Range(“A1”).Select
Do Until ActiveCell.Value = “”
Sheets.Add.Name = ActiveCell.Value
Sheets(“Names”).Select
ActiveCell.Offset(1, 0).Select
Loop
End Sub

How to use codes shared here?

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.