Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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
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
Subscript out of range OKHM Excel Discussion (Misc queries) 0 August 6th 09 05:18 PM
Subscript out of Range Steve Excel Discussion (Misc queries) 3 April 15th 09 04:01 PM
what does 'Subscript Out of range' mean?? Gary Excel Worksheet Functions 2 March 22nd 07 01:33 AM
9: Subscript out of range jenz21985 Excel Discussion (Misc queries) 6 May 5th 06 03:36 PM
Subscript Out of Range John Wilson Excel Programming 2 September 7th 03 04:07 AM


All times are GMT +1. The time now is 06:32 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"