View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mattsvai[_6_] mattsvai[_6_] is offline
external usenet poster
 
Posts: 1
Default External Cell Reference in VBA?


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

--
mattsva
-----------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...fo&userid=3113
View this thread: http://www.excelforum.com/showthread.php?threadid=50810