View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_4_] Steve[_4_] is offline
external usenet poster
 
Posts: 184
Default Renaming newly added worksheets

Hello. I have a button that copies an existing worksheet and names it
"New Csutomer". The problem is when the user pushes the button twice
the code errors out because there is already a sheet named "New
Customer". Is there a way to append a number to the new sheets so
this does not happen? Thanks!!

Private Sub CommandButton2_Click() 'Add new Customer Calc Sheets

Sheets("Customer Number").Copy Befo=Sheets(3)
ActiveSheet.Name = "New Customer"

End Sub