ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime Error 9 Subscript Outta Range (https://www.excelbanter.com/excel-programming/388804-runtime-error-9-subscript-outta-range.html)

David

Runtime Error 9 Subscript Outta Range
 
This is driving me NUTS! This code works just fine in other workbooks, but
something is wrong here. I am getting the error on the last line of code.
Same error when trying to activate the wbkSum workbook too.
Here is the code:

Dim wbkSum As Workbook
Dim wbkData As Workbook
Dim iOffice As Integer

Set wbkSum = Workbooks("My DMR Summary May 2007.xls")
Set wbkData = ActiveWorkbook

Windows("wbkData").Activate

Tim Williams

Runtime Error 9 Subscript Outta Range
 
wbkData.Activate

Tim

"David" wrote in message
...
This is driving me NUTS! This code works just fine in other workbooks, but
something is wrong here. I am getting the error on the last line of code.
Same error when trying to activate the wbkSum workbook too.
Here is the code:

Dim wbkSum As Workbook
Dim wbkData As Workbook
Dim iOffice As Integer

Set wbkSum = Workbooks("My DMR Summary May 2007.xls")
Set wbkData = ActiveWorkbook

Windows("wbkData").Activate




Dave Peterson

Runtime Error 9 Subscript Outta Range
 
I wouldn't go through the windows collection.

I'd just use:
wbkdata.activate




David wrote:

This is driving me NUTS! This code works just fine in other workbooks, but
something is wrong here. I am getting the error on the last line of code.
Same error when trying to activate the wbkSum workbook too.
Here is the code:

Dim wbkSum As Workbook
Dim wbkData As Workbook
Dim iOffice As Integer

Set wbkSum = Workbooks("My DMR Summary May 2007.xls")
Set wbkData = ActiveWorkbook

Windows("wbkData").Activate


--

Dave Peterson

FSt1

Runtime Error 9 Subscript Outta Range
 
hi.
I see that your code is for a specific workbook and specific worksheet. just
looking at the code you posted, i suspect this may be your problem.
the scrip out of range reeor message pops up usually when excel can't find
something. Edit your workbook name and worksheet name and see if that solves
your problem. if not, post back with more detail.

Regards
FSt1

"David" wrote:

This is driving me NUTS! This code works just fine in other workbooks, but
something is wrong here. I am getting the error on the last line of code.
Same error when trying to activate the wbkSum workbook too.
Here is the code:

Dim wbkSum As Workbook
Dim wbkData As Workbook
Dim iOffice As Integer

Set wbkSum = Workbooks("My DMR Summary May 2007.xls")
Set wbkData = ActiveWorkbook

Windows("wbkData").Activate


David

Runtime Error 9 Subscript Outta Range
 
Thanks much! Works fine now!

"Tim Williams" wrote:

wbkData.Activate

Tim

"David" wrote in message
...
This is driving me NUTS! This code works just fine in other workbooks, but
something is wrong here. I am getting the error on the last line of code.
Same error when trying to activate the wbkSum workbook too.
Here is the code:

Dim wbkSum As Workbook
Dim wbkData As Workbook
Dim iOffice As Integer

Set wbkSum = Workbooks("My DMR Summary May 2007.xls")
Set wbkData = ActiveWorkbook

Windows("wbkData").Activate






All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com