I am new to the forum. I have been using it for excel help for years and never had a need to ask my own question until now. I have searched high and low for the answer to this. I am sure it is simple, but I cant find it anywhere.
I have an excel macro that is duplicating a template and renaming the tabs from a list. What I would like, is to be able to run the macro more than once (i.e. if someone adds to the list) without getting a bug error. So, I need to add to this macro to tell excel to just overlook the duplicates and keep going until it gets to the next unique name.
The list i am using is on a tab called "Opportunity Pipeline" in column A. The tab I would like to copy and rename is called "Template" - the "Template" is hidden so I also need the code to unhide the template, copy it, rename it (multiple times) and then hide it again.
Can someone please help me? Here is my code:
Sub CreateSheetsFromAList()Dim MyCell, MyRange As RangeSet MyRange = Sheets("Opportunity Pipeline").Range("A3")Set MyRange = Range(MyRange, MyRange.End(xlDown))Sheets("Template").Visible = TrueFor Each MyCell In MyRange Sheets("Template").Copy After:=Sheets(Sheets.Count) ActiveSheet.Name = MyCell.Value ' renames the new worksheet Next MyCellSheets("Template").Visible = FalseEnd Sub