Please check my code. Getting runtime error 9. Subcript out of range

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Code:
sub try()
Windows("trybook[2].xls1").Activate
cells(1).select
 
End Sub
 

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.
Using the method and example file, from post #10, and the code below, it works for me in 2007.

Code:
Sub try()
  Windows("For Pedie[1].xls").Activate
  Cells(1, 1).Copy Workbooks("Book1").Sheets("Sheet1").Cells(1, 1)
End Sub

In 2010 I got the runtime error 9. Subcript out of range message, and had to Enable Editing on the Protected View bar, after that it worked OK.

See the links.

http://office.microsoft.com/en-gb/p...tecting-your-files-RZ101665538.aspx?section=7

http://office.microsoft.com/en-us/excel-help/what-is-protected-view-HA010355931.aspx
 
Upvote 0
Hi Brian,

Yesterday went to sleep early and today i was busy through out the day @ work so couldnt spent time with this thread....!

Anways...want to say thanks for alot for suggestion and for researching for me. Now it seems to work in xls 07, i'll try in 10 when i get to work again...hopefully it should work like you have suggested...


Thanks again and have a great weekend!;)
And thanks again to Vog and everyone who helped.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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