Referencing cell content as a defined global variable

kschmeer

New Member
Joined
Oct 8, 2014
Messages
11
My macro-enabled excel has 2 separate executable sections of Code.
First section executed upon opening the file. Then Stops.
The file remains open so that the user can check the results in a table at that time.
Once the results are verified, the user pressed ctrl-r to resume execution.
The problem I hit was the global variables that were set in the first section, do not
retaining their settings when the first section stops, and the second section starts.

Rather than prompting the user for the variables' values I save the values in a worksheet, as seen here:

1715622961972.png


Column A is the name of the already defined global variable.
Column B is the value the variable is set to.

My thinking was to reset the variables as such:

Cells(2, 1).Value = Cells(2, 2).Value

but this would only gave cell A2 the value in cell B2.
I want to use the value in A2 as a reference to the global var "ProgramFile"
and set that variable to "Checks To TD.xlsm".

I've been able to make this work using a Select Statement, but it's a bit kludgy...

Is it possible to read cell A2 as an already defined variable and assign a value to it?

Thank you in advance.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,224,735
Messages
6,180,635
Members
452,992
Latest member
TokugawaIesuma

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
Back
Top