I have 02 sheets as follows. I want to add new sheets with name predetermined in "Sheet_Name" Column of Sheet " Summarize".
For example: I have entered 03 sheet name " ABC" , "BCC", "XYZ" then 03 sheets will be created with corresponding name. Then I will copy the content of the sheet "Template" to " ABC", "BCC", "XYZ" and change the B1 value of new sheets with its name.
How can I do this with VBA? I have written a snippet for creating but it can not run. Thanks.
Sub Macro2()
Dim i As Integer
Dim n As Integer
n = ThisWorkbook.Sheets(Summary).Range("B2", ActiveCell.End(xlDown)).Count
For i = 1 To n
Sheets.Add
Sheets.Add.Name = ThisWorkbook.Sheets(Summary).Cells(i + 1, B).Value
Next i
End Sub
Sheet " Summarize"
Sheet "Template"
As per the guide of Bigben, I write these codes to create new sheets but apart from "ABC", "BCC", "XYZ", it created 03 other sheets.
Sub Macro2()
Dim i As Integer
Dim n As Integer
With Sheets("Summary")
n = .Range("B"& .Rows.Count).End(xlUp).Row - 1
For i = 1 To n
Sheets.Add
Sheets.Add.Name = ThisWorkbook.Sheets("Summary").Cells(i + 1, 2).Value
Next i
End With
End Sub