Hi All,
I am trying to find a macro that can copy a template worksheet multiple times and rename the worksheet based on a list in another worksheet starting from cell B6.
"Template" is the name of the sheet to be copied
"Client List" is the name of the worksheet in which the list is with some other information but I need to rename them according to the cell B6 and down.
I found a code in one of the threads relevant to this:
Issue in the above code: I have to regularly update the "Client List" time to time thus require to re-run the macro. If I re-run the above code, it shows Error 1004 (Name is already taken) and creates a copy of "Template" with the name "Template (2)" at the end.
Modification required: If a sheet with the name is already created (as the macro was run earlier), the macro should continue to run and copy the "Template" sheet and rename it to the remaning values in the "Client List" till the list is not over. It should not affect the already created copies.
Please Help. Thank You!
I am trying to find a macro that can copy a template worksheet multiple times and rename the worksheet based on a list in another worksheet starting from cell B6.
"Template" is the name of the sheet to be copied
"Client List" is the name of the worksheet in which the list is with some other information but I need to rename them according to the cell B6 and down.
I found a code in one of the threads relevant to this:
VBA Code:
Sub makeSheets()
Dim sh1 As Worksheet, sh2 As Worksheet, c As Range
Set sh1 = Sheets("Template")
Set sh2 = Sheets("Client List")
For Each c In sh2.Range("B5", sh2.Cells(Rows.Count, 2).End(xlUp))
sh1.Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = c.Value
Next
Issue in the above code: I have to regularly update the "Client List" time to time thus require to re-run the macro. If I re-run the above code, it shows Error 1004 (Name is already taken) and creates a copy of "Template" with the name "Template (2)" at the end.
Modification required: If a sheet with the name is already created (as the macro was run earlier), the macro should continue to run and copy the "Template" sheet and rename it to the remaning values in the "Client List" till the list is not over. It should not affect the already created copies.
Please Help. Thank You!