ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   External Cell Referencing in VBA? (https://www.excelbanter.com/excel-programming/352272-external-cell-referencing-vba.html)

mattsvai

External Cell Referencing in VBA?
 

Hi everyone! This is my first post on this board :)

I just want to know how I can do the following in VBA:

=[Book1998.xls]Sheet1!$F$1


Thanks!

Matt

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


Bob Phillips[_6_]

External Cell Referencing in VBA?
 
Workbooks("Book 1998.xls").Worksheets("Sheet1").Range("F1")

the range has many properties such as .Value, .Formula, etc. which can tag
ob the end.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"mattsvai" wrote in
message ...

Hi everyone! This is my first post on this board :)

I just want to know how I can do the following in VBA:

=[Book1998.xls]Sheet1!$F$1


Thanks!

Matts


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

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




mattsvai[_2_]

External Cell Referencing in VBA?
 

Thanks for the reply Bob,

That is exactly the first thing that came to mind.... but I could never
get it to work so I assumed I was way off. This is what I have been
doing:

----
Sub import()
Dim var As String

var = Workbooks("master.xls").Worksheets("Sheet1").Range ("A2")
MsgBox var

End Sub

-------

Yet I always get an "Out of Range" error

Any ideas would be appreciated :)

Thanks again,

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=507987


mattsvai[_3_]

External Cell Referencing in VBA?
 

Thanks for the reply Bob,

That is exactly the first thing that came to mind.... but I could never
get it to work so I assumed I was way off. This is what I have been
doing:

----
Sub import()
Dim var As String

var = Workbooks("master.xls").Worksheets("Sheet1").Range ("A2")
MsgBox var

End Sub

-------

Yet I always get an "Out of Range" error

Any ideas would be appreciated :)

Thanks again,

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=507987


mattsvai[_4_]

External Cell Referencing in VBA?
 

Thanks for the reply Bob,

That is exactly the first thing that came to mind.... but I could never
get it to work so I assumed I was way off. This is what I have been
doing:

----
Sub import()
Dim var As String

var = Workbooks("master.xls").Worksheets("Sheet1").Range ("A2")
MsgBox var

End Sub

-------

Yet I always get an "Out of Range" error

Any ideas would be appreciated :)

Thanks again,

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile: http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=507987


Tim Williams

External Cell Referencing in VBA?
 
Is the workbook you're trying to reference open ?

Things are a bit different if not....

Tim

"mattsvai" wrote in
message ...

Thanks for the reply Bob,

That is exactly the first thing that came to mind.... but I could never
get it to work so I assumed I was way off. This is what I have been
doing:

----
Sub import()
Dim var As String

var = Workbooks("master.xls").Worksheets("Sheet1").Range ("A2")
MsgBox var

End Sub

-------

Yet I always get an "Out of Range" error

Any ideas would be appreciated :)

Thanks again,

Matts


--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:
http://www.excelforum.com/member.php...o&userid=31134
View this thread: http://www.excelforum.com/showthread...hreadid=507987




mattsvai[_5_]

External Cell Referencing in VBA?
 

It is meant to be closed... I want to access a cell in an excel fil
that is closed :

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


Bill Martin[_2_]

External Cell Referencing in VBA?
 
When faced with that need, I generally test that the workbook is not open, then
open the book as read only, do my stuff, then close the book again if it wasn't
open to start with.

Bill
--------------------
mattsvai wrote:
It is meant to be closed... I want to access a cell in an excel file
that is closed :)




All times are GMT +1. The time now is 01:27 AM.

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