I'm trying to make a macro that creates a new worksheet, based on a template sheet ("Default" below) and then hides that template sheet. The problem occurs if the user forgets to rename the new worksheet (and leaves it titled as "Insert Client Name") and then tries to rerun the macro.
How would I be able to get an error message to display if this occurs?
Sub CreateNewClient()
Sheets("Default").Visible = True
Sheets("Default").Select
Sheets("Default").Copy Before:=Sheets(2)
Sheets("Default (2)").Select
Sheets("Default (2)").Name = Insert Client Name"
Sheets("Default").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Insert Client Name").Select
End Sub
How would I be able to get an error message to display if this occurs?
Sub CreateNewClient()
Sheets("Default").Visible = True
Sheets("Default").Select
Sheets("Default").Copy Before:=Sheets(2)
Sheets("Default (2)").Select
Sheets("Default (2)").Name = Insert Client Name"
Sheets("Default").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Insert Client Name").Select
End Sub