![]() |
Reference of Range in another file with VB
Hi all:
A new problem comes to me, maybe some of you have already experience on it. Because of the file size (18 MB), I split this excel file (containing VB code) in two files A and B. Now is the problem: 1. The Config sheet of file A contains some data which will be used by two files. In this sheet are several Ranges defined. These range are used by other sheets which are now in both files and in VB code. Question: 1. How can I make a reference to a range in file Afrom VB code in file B? I have tried to use like for each a in [A]Config!ref_range or: for each a in ["A"]Config!ref_range Neither woks. 2. I opened the linked excel file A with VB program. Is it unnessary because there are already links between sheets? Will two instance of the excel file A be opened? If I don't do it in VB, the VB code doesn't run. Is there a better way to do it? |
Reference of Range in another file with VB
dim c as range
for each c in workbooks("A.xls").range("ref_range").cells 'do stuff next c Tim "Steven P" wrote in message ups.com... Hi all: A new problem comes to me, maybe some of you have already experience on it. Because of the file size (18 MB), I split this excel file (containing VB code) in two files A and B. Now is the problem: 1. The Config sheet of file A contains some data which will be used by two files. In this sheet are several Ranges defined. These range are used by other sheets which are now in both files and in VB code. Question: 1. How can I make a reference to a range in file Afrom VB code in file B? I have tried to use like for each a in [A]Config!ref_range or: for each a in ["A"]Config!ref_range Neither woks. 2. I opened the linked excel file A with VB program. Is it unnessary because there are already links between sheets? Will two instance of the excel file A be opened? If I don't do it in VB, the VB code doesn't run. Is there a better way to do it? |
Reference of Range in another file with VB
Thank you, it works with
workbooks(...).Worksheets(...).range("...").cells You have saved my day. On 2 Nov., 12:19, "Tim Williams" <timjwilliams at gmail dot com wrote: dim c as range for each c in workbooks("A.xls").range("ref_range").cells 'do stuff next c Tim "Steven P" wrote in message ups.com... Hi all: A new problem comes to me, maybe some of you have already experience on it. Because of the file size (18 MB), I split this excel file (containing VB code) in two files A and B. Now is the problem: 1. The Config sheet of file A contains some data which will be used by two files. In this sheet are several Ranges defined. These range are used by other sheets which are now in both files and in VB code. Question: 1. How can I make a reference to a range in file Afrom VB code in file B? I have tried to use like for each a in [A]Config!ref_range or: for each a in ["A"]Config!ref_range Neither woks. 2. I opened the linked excel file A with VB program. Is it unnessary because there are already links between sheets? Will two instance of the excel file A be opened? If I don't do it in VB, the VB code doesn't run. Is there a better way to do it?- Zitierten Text ausblenden - - Zitierten Text anzeigen - |
All times are GMT +1. The time now is 02:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com