Making a Variable Global

gemcgraw

Board Regular
Joined
Mar 11, 2011
Messages
72
I am toggling command buttons (enable/disable) based on a variable's value from the same or another spread sheet. I believe I need to make those variables globle in order for the statement to correctly see it. I'm not sure if that is my issue or not and how I can effectively do that. I am including the "Dim" statement on the sheets involved as well as setting the "integer" value to 1 and/or 0. Ideas and comments appreciated.

i.e. If they click on the "Print" Command button, I toggle the PrintHistory interger to 1, if that is true, then the "Move History" command button integer is set to "1", else, it's set to "0" which disables the "Move History" command button.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,
Just declare them outside the procs, example follows
Code:
Public gintPrintHistory As Integer
Private Sub cmdPrint_Click()
    gintPrintHistory = 1
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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