Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Does the sheet exist?

I need the syntax for checking that a given sheet exist identified by it's
CODE name.

Is anybody game?
The Doctor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Does the sheet exist?

Something like this will do it:

Function TestForSheet(lSheetNumber As Long) As Boolean

Dim strSheetName As String

On Error Resume Next
strSheetName = Sheets(lSheetNumber).Name

If Err.Number = 0 Then
TestForSheet = True
Else
TestForSheet = False
End If

On Error GoTo 0

End Function


Sub test()
MsgBox TestForSheet(100)
End Sub


RBS

"Dr.Schwartz" wrote in message
...
I need the syntax for checking that a given sheet exist identified by it's
CODE name.

Is anybody game?
The Doctor


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
Want a trace a same values exist in two different sheet Mukesh Excel Worksheet Functions 2 April 23rd 09 12:56 PM
VBA: Make a new sheet if it doesn't exist PaulW Excel Discussion (Misc queries) 2 May 8th 06 03:45 PM
VBA, Make a new sheet if it doesn't exist PaulW Excel Discussion (Misc queries) 1 May 5th 06 05:25 PM
test if a sheet exist (with the name) ? LoloSoft Excel Programming 4 February 17th 04 02:39 PM
Does sheet exist? Sean Evanovich Excel Programming 2 November 19th 03 02:30 PM


All times are GMT +1. The time now is 01:51 PM.

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

About Us

"It's about Microsoft Excel"