ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subscript out of range (https://www.excelbanter.com/excel-programming/306042-subscript-out-range.html)

Bill Murphy

Subscript out of range
 
I have an application consisting of two open workbooks. The first workbook
opens, then opens the second workbook. The second workbook contains very
little VBA code, just the following:

Private Sub Workbook_Open()

ThisWorkbook.RefreshAll

End Sub

When the End Sub is reached I get the error message Run-time error 9 -
Subscript out of range.

The purpose of the second workbook is to import a table from a mainframe,
which is then used by the first workbook using Vlookup. I would like to
have the application automatically reactivate the first workbook once the
second workbook has finished it's import and refreshed.

Any ideas are welcome.

Bill



Nigel

Subscript out of range
 
I have an application consisting of two open workbooks. The first
workbook
opens, then opens the second workbook. The second workbook contains very
little VBA code, just the following:


Doesn't take much to cause VBA to throw an error!

Private Sub Workbook_Open()

ThisWorkbook.RefreshAll

End Sub

When the End Sub is reached I get the error message Run-time error 9 -
Subscript out of range.


Do you mean this end sub or some other part of the code?

The purpose of the second workbook is to import a table from a mainframe,
which is then used by the first workbook using Vlookup. I would like to
have the application automatically reactivate the first workbook once the
second workbook has finished it's import and refreshed.


When are you doing this, is this before the error or after?

Any ideas


Suggest you submit the code for closer inspection

Cheers
Nigel




All times are GMT +1. The time now is 12:27 PM.

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