ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Values from another workbook (https://www.excelbanter.com/excel-programming/318871-values-another-workbook.html)

Ajit

Values from another workbook
 
I have two workbooks open. Workbook A and workbook B

Workbook B has some data in a column named as a range "rng_Data" (Variable
range : with Offset formula)

I want to access the same data in workbook A

Below is what i will do to get all the values of the range if it would have
been in the same workbook. What would i do to get the values of a range from
another workbook (which is open) ?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next

msgbox str_Values




--
Ajit

Tom Ogilvy

Values from another workbook
 
set rng = Workbooks("WorkbookB.xls").Names("rng_Data").Refer sToRange
for each c in rng
str_Values = str_Values & "," & c
Next

msgbox Left(str_Values,len(str_Values)-1)

--
Regards,
Tom Ogilvy


"Ajit" wrote in message
...
I have two workbooks open. Workbook A and workbook B

Workbook B has some data in a column named as a range "rng_Data" (Variable
range : with Offset formula)

I want to access the same data in workbook A

Below is what i will do to get all the values of the range if it would

have
been in the same workbook. What would i do to get the values of a range

from
another workbook (which is open) ?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next

msgbox str_Values




--
Ajit




Ajit

Values from another workbook
 
Thanks, Tom..
It works perfect.

Just querious to know that can we refer to the range in other workbook in
rng_data...keeping the below loop as it is?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next


"Tom Ogilvy" wrote:

set rng = Workbooks("WorkbookB.xls").Names("rng_Data").Refer sToRange
for each c in rng
str_Values = str_Values & "," & c
Next

msgbox Left(str_Values,len(str_Values)-1)

--
Regards,
Tom Ogilvy


"Ajit" wrote in message
...
I have two workbooks open. Workbook A and workbook B

Workbook B has some data in a column named as a range "rng_Data" (Variable
range : with Offset formula)

I want to access the same data in workbook A

Below is what i will do to get all the values of the range if it would

have
been in the same workbook. What would i do to get the values of a range

from
another workbook (which is open) ?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next

msgbox str_Values




--
Ajit





Tom Ogilvy

Values from another workbook
 
One workbook has no knowledge of the names in another workbook to the best
of my knowledge.

--
Regards,
Tom Ogilvy

"Ajit" wrote in message
...
Thanks, Tom..
It works perfect.

Just querious to know that can we refer to the range in other workbook in
rng_data...keeping the below loop as it is?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next


"Tom Ogilvy" wrote:

set rng = Workbooks("WorkbookB.xls").Names("rng_Data").Refer sToRange
for each c in rng
str_Values = str_Values & "," & c
Next

msgbox Left(str_Values,len(str_Values)-1)

--
Regards,
Tom Ogilvy


"Ajit" wrote in message
...
I have two workbooks open. Workbook A and workbook B

Workbook B has some data in a column named as a range "rng_Data"

(Variable
range : with Offset formula)

I want to access the same data in workbook A

Below is what i will do to get all the values of the range if it would

have
been in the same workbook. What would i do to get the values of a

range
from
another workbook (which is open) ?

For Each c In Range(rng_Data)
str_Values = str_Values & ", " & c
Next

msgbox str_Values




--
Ajit








All times are GMT +1. The time now is 04:29 PM.

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