Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference to cell with external spreadsheet B Lane Excel Worksheet Functions 1 December 19th 09 08:09 PM
Using cell value to build external reference Todd Lietha Excel Discussion (Misc queries) 11 October 1st 07 05:50 PM
cell data for external reference Frank Excel Worksheet Functions 1 December 10th 06 03:44 AM
Reference external worksheet whose name is in a cell Poly4 Excel Worksheet Functions 1 July 20th 06 03:12 AM
Using cell value to reference external worksheet? tsobiech Excel Worksheet Functions 2 March 6th 06 03:11 PM


All times are GMT +1. The time now is 08:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"