ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to refer to a cell in a different file (https://www.excelbanter.com/excel-programming/347885-vba-refer-cell-different-file.html)

dazman[_14_]

VBA to refer to a cell in a different file
 

Hi,

Really stupid question, but I'm not sure of the syntax to refer to
cell in another worksheet from within VBA. I'm trying:

temp = C:\Documents and Settings\Daz\Desktop\HYP Screene
v11.xls[ShareData]!L3

or

temp = '[HYP Screener v11.xls]ShareData'!L3

and neither seems to work. The file I'm working on is in the same di
as the file I'm trying to access. Can anyone point me in the righ
direction?

Cheers,

Da

--
dazma
-----------------------------------------------------------------------
dazman's Profile: http://www.excelforum.com/member.php...fo&userid=2590
View this thread: http://www.excelforum.com/showthread.php?threadid=49268


Bob Phillips[_6_]

VBA to refer to a cell in a different file
 
temp = workbooks("HYP Screener
v11.xls").Worksheets("ShareData").Range("L3")

this will require the workbook to be open


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"dazman" wrote in
message ...

Hi,

Really stupid question, but I'm not sure of the syntax to refer to a
cell in another worksheet from within VBA. I'm trying:

temp = C:\Documents and Settings\Daz\Desktop\HYP Screener
v11.xls[ShareData]!L3

or

temp = '[HYP Screener v11.xls]ShareData'!L3

and neither seems to work. The file I'm working on is in the same dir
as the file I'm trying to access. Can anyone point me in the right
direction?

Cheers,

Daz


--
dazman
------------------------------------------------------------------------
dazman's Profile:

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




dazman[_15_]

VBA to refer to a cell in a different file
 

Thanks for that!


--
dazman
------------------------------------------------------------------------
dazman's Profile: http://www.excelforum.com/member.php...o&userid=25903
View this thread: http://www.excelforum.com/showthread...hreadid=492683



All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com