Runtime Error 9

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
608
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Are you using Workbooks or Windows to activate the workbook? The former should work regardless of the window caption.
 
Upvote 0
I was using
Windows(MyWB).activate

So when I changed to
Workbooks(MyWB).activate

It worked great! Thanks for the tip!
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

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