Subscript out of range error

  • Thread starter Thread starter enz
  • Start date Start date
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
 
If you replace Range("A35") with Cells("A35) (or Cells
(1,35) then that should work.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top