View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Mounsey Peter Mounsey is offline
external usenet poster
 
Posts: 1
Default Finding worksheet


"jnf40" wrote in message
...
Hi all,

I have a workbook that adds worksheets, names them and sorts them. The
naming is done by a cell entry from a userform. I would like to check for

a
worksheet with the same name as the entry from the userform then ask the

user
if they want to add another worksheet with that name or activate the last
worksheet made with that name. As in another post I have, the worksheets
could be DBL ARROW for worksheet1 name, if the user enters DBL ARROW again
then it would ask them if they want another worksheet with the same name,

if
they do it would create DBL ARROW (2), if the user enters DBL ARROW again
then it would ask them if they want another worksheet with the same name,

if
they do it would create DBL ARROW (3), if they do not want another with

the
same name then they could activate the last one made, which was DBL ARROW
(2), or they could cancel and not create another worksheet with that name.

Is
there a way to do this?


For i=1 to worksheets.count
if sheets(i).name=<NEW NAME then
if msgbox("A sheet with this name exists, do you want to use that
sheet"),vbYesNo)=vbNo then
'Add new sheet
exit for
else
sheets(i).activate
exit for
endif
endif
next
if i worksheets.count then
'Add sheet
endif


Pete