Find Worksheet name

  • Thread starter Thread starter birdseye
  • Start date Start date
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
 
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
 
Back
Top