![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com