Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Name Verification

I have a userform that creates a new worksheet, enters data from the form,
and performs calculations based on that data. One of the entries on the form
is an ID which becomes the name of the new worksheet. How can I check the
names of all the worksheets (indefinite number of sheets) to verify the new
ID isn't a duplicate and stop the program from running? The desired result
is to prompt the user for a new name and then run the procedure. I tried an
If...Then...Else statement, but it's renaming and overwriting the original
and still creating a new blank sheet. I hope I haven't confused you! Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Name Verification

assume id is in myVar

On Error Resume Next
Set sh = worksheets(myVar)
On Error Goto 0
If sh Is Nothing Then
Worksheets.Add.name = myVar
End If

--
HTH

Bob Phillips

"MAWII" wrote in message
...
I have a userform that creates a new worksheet, enters data from the form,
and performs calculations based on that data. One of the entries on the

form
is an ID which becomes the name of the new worksheet. How can I check the
names of all the worksheets (indefinite number of sheets) to verify the

new
ID isn't a duplicate and stop the program from running? The desired

result
is to prompt the user for a new name and then run the procedure. I tried

an
If...Then...Else statement, but it's renaming and overwriting the original
and still creating a new blank sheet. I hope I haven't confused you!

Thanks!


Reply
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
Pop up verification when opening a sheet. [email protected] Excel Worksheet Functions 5 October 30th 07 10:15 PM
cell verification Firkins Excel Discussion (Misc queries) 2 October 2nd 07 05:40 PM
Date verification Oldjay Excel Discussion (Misc queries) 4 October 24th 06 03:52 AM
data verification Kristen Excel Discussion (Misc queries) 0 July 14th 06 02:31 PM
Licence Verification alanford Excel Programming 6 March 1st 05 02:01 PM


All times are GMT +1. The time now is 03:25 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"