Run time error

CHuguley

New Member
Joined
Feb 17, 2002
Messages
45
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.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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.
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top