If Sheet exists, GOTHERE, else create it

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All......

If someone would be so kind, I would appreciate finding out how to determine
is a sheet named "specificsheet" already exists, and if so to switch to it,
otherwise to create it and then switch to it......

Thanking you muchly in advance,
Vaya con Dios,
Chuck, CABGx3
 
On Error Resume Next
Set sh = Worksheets("specificsheet")
On Erroro Goto 0
If sh Is Nothing then
Worksheets.Add.Name = Worksheets("specificsheet")
Else
sh.ACtivate
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks Bob......

After a little massaging, it worked fine in my XL97 (sorry, forgot to
mention in original post)

Dim sh As Worksheet 'added this line
On Error Resume Next
Set sh = Worksheets("SpecificSheet")
On Error GoTo 0
If sh Is Nothing Then
' Worksheets.Add.Name = Worksheets("SpecificSheet")
Worksheets.Add.Name = ("SpecificSheet") 'changed above line
Else
sh.Activate
End If

I do appreciate your help,.....I could not have gotten there without it.
Vaya con Dios,
Chuck, CABGx3
 
CLR said:
Thanks Bob......

After a little massaging, it worked fine in my XL97 (sorry, forgot to
mention in original post)
' Worksheets.Add.Name = Worksheets("SpecificSheet")
Worksheets.Add.Name = ("SpecificSheet") 'changed above line

Really? You surprise me. Going to dig out my old NT4 machine and check this
:-)
 
Back
Top