Create Multiple Sheets based on the cell value through VBA
Sub Addsheet()
'Declaring the Variables
'Declaring the Variables
Dim i As Integer
Dim LastRow As Integer
'Finding Last Row in Sheet1
'Finding Last Row in Sheet1
LastRow = Worksheets("Sheet1").Cells(Worksheets("Sheet1").Rows.Count, "A").End(xlUp).Row
'Using For Loop to Add Sheets by Cell Value
'Using For Loop to Add Sheets by Cell Value
For i = 1 To LastRow
Sheets.Add
ActiveSheet.Name = Worksheets("Sheet1").Cells(i, 1).Value
Next i
End Sub
Lets Discuss the above code:
- We have defined two variable "i" and "LastRow".
- LastRow find the the row in "Sheet1" from Column "A". Because the list of sheets names are stored in "A" column in "Sheet1".
- We have used for loop to create multiple sheets untill all the sheets are created.
You can watch below video in action.