Runtime Error 9

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
591
I changed the activewindow.caption and in code in another vba project. Now I have saved the name of the current spreadsheet and activate another spreadsheet. Then when I try to go back to my original spreadsheet, I get the error, "Runtime Error 9 Subscript out of range". But the name of the workbook is exactly the same as the name I am trying to activate. Could the caption change have something to do with my error? Thanks. If so, what do I do?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Are you using Workbooks or Windows to activate the workbook? The former should work regardless of the window caption.
 

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
591
I was using
Windows(MyWB).activate

So when I changed to
Workbooks(MyWB).activate

It worked great! Thanks for the tip!
 

Forum statistics

Threads
1,136,970
Messages
5,678,895
Members
419,788
Latest member
Mukund2903

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
Top