ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing a named range in another workbook (https://www.excelbanter.com/excel-programming/404804-referencing-named-range-another-workbook.html)

Nigel RS[_2_]

Referencing a named range in another workbook
 
Simple one - I think!

My main application (Excel Workbook) opens another workbook with named
range(single cell). How can I refer to these named ranges and return the
value.
In the following code I am trying to set the sheet shControl (codename)
range A1 to the value in the dataWb named range "OptRef"

Dim dataWb as Workbook
Set dataWb = Workbooks.Open(myfile)
With dataWb.Sheets("Sheet1")
shcontrol.range("A1") = ????
End With

TIA

Jim Cone

Referencing a named range in another workbook
 
shcontrol.range("A1").Value = .Range("OptRef").Value
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Nigel RS"
wrote in message
Simple one - I think!

My main application (Excel Workbook) opens another workbook with named
range(single cell). How can I refer to these named ranges and return the
value.
In the following code I am trying to set the sheet shControl (codename)
range A1 to the value in the dataWb named range "OptRef"

Dim dataWb as Workbook
Set dataWb = Workbooks.Open(myfile)
With dataWb.Sheets("Sheet1")
shcontrol.range("A1") = ????
End With

TIA

Nigel[_2_]

Referencing a named range in another workbook
 
Thanks Jim, I got tangled up in using the workbook Names collection and lost
sight of the Range !

--

Regards,
Nigel




"Jim Cone" wrote in message
...
shcontrol.range("A1").Value = .Range("OptRef").Value
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Nigel RS"
wrote in message
Simple one - I think!

My main application (Excel Workbook) opens another workbook with named
range(single cell). How can I refer to these named ranges and return the
value.
In the following code I am trying to set the sheet shControl (codename)
range A1 to the value in the dataWb named range "OptRef"

Dim dataWb as Workbook
Set dataWb = Workbooks.Open(myfile)
With dataWb.Sheets("Sheet1")
shcontrol.range("A1") = ????
End With

TIA




All times are GMT +1. The time now is 06:03 PM.

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