Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Subscript our of range when activating a worksheet
one way:
Dim wkSht As Worksheet On Error Resume Next Set wkSht = dataWB.Sheets(Invoice_Sheet) On Error GoTo 0 If Not wkSht Is Nothing Then 'Do Stuff Else MsgBox "Sheet " & Invoice_Sheet & " does not exist." End If In article , "cb" wrote: Hi all, I try to activate a worksheet that macro can't find. The code is like this: dataWB.Sheets(Invoice_Sheet).Activate Because the sheet name does not exist, users got a run- time error '9', Subscript out of range. Is there a way to replace this runtime error with a warning message using msgbox? Thanks, cb |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Subscript out of range | Excel Discussion (Misc queries) | |||
Subscript out of Range | Excel Discussion (Misc queries) | |||
what does 'Subscript Out of range' mean?? | Excel Worksheet Functions | |||
9: Subscript out of range | Excel Discussion (Misc queries) | |||
Subscript Out of Range | Excel Programming |