Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default detect worksheet

i would like to see if a specific worksheet is in a workbook. something
like:

If issheet("sheetX") Then
'look up stuff on 'sheetX'
Else
'don't look up stuff on 'sheetX'
End If

i realize "issheet" is wrong, but what would be correct? thanks, mike allen


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default detect worksheet

Do you mean this Mike

Sub test()
If ActiveSheet.Name = "Sheet1" Then
MsgBox "Sheet1 is the ActiveSheet"
Else
MsgBox "Sheet1 is not the ActiveSheet"
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"mike allen" wrote in message ...
i would like to see if a specific worksheet is in a workbook. something
like:

If issheet("sheetX") Then
'look up stuff on 'sheetX'
Else
'don't look up stuff on 'sheetX'
End If

i realize "issheet" is wrong, but what would be correct? thanks, mike allen




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default detect worksheet

Take a look at John Walkenbach's SheetExists function:

http://www.j-walk.com/ss/excel/tips/tip54.htm

You could also do it inline:

Dim wkSht As Worksheet
On Error Resume Next
Set wkSht = Worksheets("SheetX")
On Error GoTo 0
If Not wkSht Is Nothing Then
'look up stuff on 'SheetX'
Else
'don't look up stuff on 'SheetX'
End If


In article ,
"mike allen" wrote:

i would like to see if a specific worksheet is in a workbook. something
like:

If issheet("sheetX") Then
'look up stuff on 'sheetX'
Else
'don't look up stuff on 'sheetX'
End If

i realize "issheet" is wrong, but what would be correct? thanks, mike allen


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
detect when columns being written to a worksheet “cross” a vertical page break gkb_cardiff Excel Worksheet Functions 0 November 28th 08 12:29 PM
Detect Duplicates Jakobshavn Isbrae Excel Worksheet Functions 5 April 25th 08 07:40 PM
How to detect #N/A and return 0? Eric Excel Discussion (Misc queries) 2 May 30th 07 06:12 AM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
How to detect changes in a column? inomata Excel Discussion (Misc queries) 0 December 14th 05 08:26 PM


All times are GMT +1. The time now is 11:25 AM.

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"