If Sheet exists, GOTHERE, else create it

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
 
B

Bob Phillips

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)
 
G

Guest

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
 
B

Bob Phillips

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
:)
 

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