Values from another workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
set rng = Workbooks("WorkbookB.xls").Names("rng_Data").RefersToRange
for each c in rng
str_Values = str_Values & "," & c
Next

msgbox Left(str_Values,len(str_Values)-1)
 
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
 
One workbook has no knowledge of the names in another workbook to the best
of my knowledge.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top