Find Worksheet name

B

birdseye

I need to add code to a macro to name the active worksheet a value of
specific cell in the workbook, if the specified Sheet Name alread
exists in the Workbook the user should be alerted via a Msgbox to th
fact that this Sheet name already exists and should select a differen
sheet name
 
F

Frank Kabel

Hi
maybe something like
sub foo()
dim rng as range
dim name_val
set rng = activesheet.range("A1")
name_val=rng.value
on error resume next
activesheet.name=name_val
if err.number<>0 then
msgbox "name already exist"
rng.clearcontents
end if
on error goto 0
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top