Subscript out of range error

E

enz

The following line of code results "subscript out of range error" on some
machines (other pc-s work just fine with the same code). All computers have
Windows XP and Excel XP.

---
G = Workbooks("hex_ee_converter.xls").Worksheets("Main").Range("A35").Value
---

The workbook hex_ee_converter.xls exists and is open when this error message
occurs. The worksheet Main also exists and is open. The cell A35 also exists
and contains value 2.

What should I do to get rid of this error message?

enz
 
H

Hayeso

If you replace Range("A35") with Cells("A35) (or Cells
(1,35) then that should work.
 
B

Bob Flanagan

It sounds like the workbook or worksheet may not truly be open. Try the
following statements just before the error line:

msgbox Workbooks("hex_ee_converter.xls").Name
msgbox Workbooks("hex_ee_converter.xls").Worksheets("Main").Name

If one of the above generates an error, it narrows the problem to either the
workbook or the worksheet

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Top