LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i get the name of a newly added sheet that i add with Sheets.Add in a vba macro in excel? Daniel Excel Worksheet Functions 1 June 23rd 05 07:28 PM
Naming a newly added sheet Chip Pearson Excel Programming 0 August 20th 04 03:26 PM
Naming a newly added sheet Frank Kabel Excel Programming 0 August 20th 04 03:25 PM
Neet to get range of newly added QueryTable Tom Ogilvy Excel Programming 1 January 27th 04 09:44 PM
Add Hyperlink to newly added worksheet? onliner Excel Programming 3 August 13th 03 02:04 AM


All times are GMT +1. The time now is 02:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"