#1
|
|||
|
|||
Mysterious "Subscript out of range" error
I have a VBA application I've developed, and one line of code works fine on my computer but refuses to work on another.
The code in question is designed to read the value of a particular cell of the spreadsheet that contains the app. It looks like this: Code:
If (Workbooks("FileConvert.xls").Worksheets("Sheet1").Range("B1").Value <> "") Then On my machine, this works fine. On the other one, it throws a "Subscript out of range" error. Both computers are running Excel 2002. I also tried referencing the sheet by index instead of name (i.e., "Worksheets(1)" instead of "Worksheets("Sheet1")"). Any ideas what could be going wrong here? It seems like a simple enough command. |
#2
|
||||
|
||||
Maybe because your VBA application couldn't find the file. Did you copy all files to the second computer?
|
#3
|
|||
|
|||
Quote:
|
#4
|
||||
|
||||
Something has to be different on this computer. The error means "your code is referring to an element in the code that does not exist." Such as:
- A non-existent sheetname - A sheet number higher than you have, such as might be encountered by looking through each sheet and deleting some sheets along the way. Near the end since there are fewer sheets you get the error message. - Outside the range of an array Maybe, paste your code here is easier. |
#5
|
|||
|
|||
Quote:
This is frustrating as hell. Fortunately, the person who's having the problem is here in town, so I'm headed down to his house to try and debug it on his machine. Hopefully there I'll be able to track the issue down. I'll keep you posted. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MYOB and "Item.Send error" Outlook message | peter_lambros | Outlook | 1 | 12-06-2008 08:24 AM |
Excel error: "Too many different cell formats" | enviroko | Excel | 0 | 01-09-2008 07:27 AM |
"IF" "THEN" statements in Macros | mfgeng_iss | Misc | 0 | 10-04-2007 07:31 AM |
"open" or "open using" option not availa | ccd | Outlook | 0 | 09-22-2006 01:23 AM |