Ability to change VB Code variables externally?

guinne55

New Member
Joined
Jul 18, 2002
Messages
7
Right now, I have a spreadsheet that opens another spreadsheet and searches for information. Sorta like this:

Workbooks.Open ("master.xls")
With Worksheets("Sheet1").Range("F3:F1000")
Set c = .find(myvariable, LookIn:=xlValues)

The problem is, Master.xls is a Date-coded name which changes periodically, and I have 1000's of Spreadsheets that reference that Master.xls. So when it's name changes, I have to cut and paste it's name into all of those files.

Is there a way to store that in a variable that can be changed from outside? What I mean is, can I make a VB code in some temp Excel file that has the new information, make a loop that opens all of the files, changes the name of Master.xls in the code, saves it and closes it? I know I can do it by placing the name in a cell in Excel, but that's not very tidy. Another way is to make a cell value reference some master directory sheet cell

In a cell "Z100" ='[Directory.xls]Sheet1'!$A$1

But that's slow, as we run these sheets on "Cube" terminals, and it takes minutes to open them if they have to reference more than one seperate file.

Any suggestions??
Thanks in advance,
Steve
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
You could store the file name in the Registry. See the SaveSetting and GetSetting functions in Help. They work with the key name HKEY_CURRENT_USERSoftwreVB and VBA Program Settings.

Or you could store the file name in a text file in the same folder as your workbook.
 

Forum statistics

Threads
1,144,056
Messages
5,722,256
Members
422,419
Latest member
Havok390

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top