External Cell Reference in VBA?

  • Thread starter Thread starter mattsvai
  • Start date Start date
M

mattsvai

I am trying to access a cell in a closed worksheet but I get an
"out of range" error:

Sub import()

Dim var as String
var = Workbooks("file1.xls").Worksheets("Sheet1").Range("A2").Value
msgbox var

End Sub

Any ideas?

Matt
 
You have received extensive answers in other postings of this question.
 

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