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