Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default If Sheet exists, GOTHERE, else create it

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default If Sheet exists, GOTHERE, else create it


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)


"CLR" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default If Sheet exists, GOTHERE, else create it

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


"Bob Phillips" wrote:


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)


"CLR" wrote in message
...
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default If Sheet exists, GOTHERE, else create it


"CLR" wrote in message
...
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
:-)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Hyperlink only if file exists bevchapman Excel Discussion (Misc queries) 4 October 16th 09 09:21 PM
Create Worksheet BUT If It Already Exists... Dave Excel Discussion (Misc queries) 2 October 30th 07 11:13 PM
Test if folder exists, create if it doesn't? 43fan Excel Programming 1 March 1st 04 04:31 PM
Test if a folder exists, create if it doesn't? 43fan Excel Programming 3 March 1st 04 02:59 PM
How can I know if a sheet exists ? Ben.C Excel Programming 3 December 29th 03 09:36 AM


All times are GMT +1. The time now is 03:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"