![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 41
|
I am still getting my feet wet with VBA. What can I do to debug the code when I get "Run-time error '9', Subscript out of range". I have VeryUnHide a worksheet and U use ctrl+k to shortcut to unhide it when I log in. Has worked perfect up to today. Any help would be greatly appreciated.
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi CHuguley,
It is always helpful when posting run-time problems to show the line of code where the problem occurs. You can find this out by clicking the Debug button on the error message dialog box. From what information you have provided my guess is that the problem is occurring on a line of code that looks like: Sheets("some sheet").Visible = True and that the problem is occurring because no such sheet exists with that name. I would recommend that you look very carefully at the name of the sheet in the VBE project pane, paying particular attention to blanks. Even leading and trailing blanks in the sheet name must be matched exactly by the text strin used in the Sheets() or Worksheets() references. If you don't see the sheet in the VBE project pane then you have accidentally deleted the sheet and that is why the code can't find it.
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
Hi
Just an abgle.. as you say OK until today , any alterations to code or the data that script looks at, nothing added amanded or deleted that could make the script trip. ill look up run 9 asap!
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|