View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default External Cell Reference in VBA?

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

--
Regards,
Tom Ogilvy

"mattsvai" wrote in
message ...

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?

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:

http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=508104