Airfix9
Well-known Member
- Joined
- Sep 23, 2005
- Messages
- 886
I have some code in a file called "Z-BUTTONS FY06 (New).xls":
On a module called "Constant_DB"
On a module called "ARF_New"
When I try to run the code, I get a Runtime Error 9 - Subscript out of range and I'm tearing my hair out trying to work out why!
The reason that I added these constants to a separate module is that many procedures in the file will refer to them and I want to be able to change them quickly and easily.
Hope that's clear enough - any help gratefully received. Of course, it is entirely probable that this is a simple issue and I can't see the wood for the trees. The file compiles fine, however and the Immediate window returns the correct value for cstZB when asked.........
On a module called "Constant_DB"
Code:
Public Const cstZB As String = "Z-BUTTONS FY06 (New).xls"
On a module called "ARF_New"
Code:
Workbooks(cstZB).Activate
ActiveWindow.Visible = False
When I try to run the code, I get a Runtime Error 9 - Subscript out of range and I'm tearing my hair out trying to work out why!
The reason that I added these constants to a separate module is that many procedures in the file will refer to them and I want to be able to change them quickly and easily.
Hope that's clear enough - any help gratefully received. Of course, it is entirely probable that this is a simple issue and I can't see the wood for the trees. The file compiles fine, however and the Immediate window returns the correct value for cstZB when asked.........