How to stop a macro on opening a workbook

MacroMan007

New Member
Joined
Aug 5, 2005
Messages
35
I have a question on how to stop a macro from executing if a cell is TRUE?

I'll have a check box for the user to select to make the form permanent. So, when re-opening the form at a later time; the date, time and autonumber will not automatically change.

I'm sure this must be possible, but I can't see how to go about doing it. I tried an if statement, but my coding must be wrong.

Thanks in advance and please let me know if you need more information...
 

Some videos you may like

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.

Georgiboy

Board Regular
Joined
Nov 7, 2008
Messages
114
If i understand you correctly, you could have the checkbox place a value in a cell on a sheet with something like...

Code:
Private Sub CheckBox1_Click()

If CheckBox1 = True Then
Sheet1.Range("A1").Value = True
Else
Sheet1.Range("A1").Value = False
End If

End Sub

Then for the code you want to run/not run you could have something like...

Code:
Sub Macro()

If Range("A1") = True Then
'run your desired code
End If

End Sub

Hope this helps
 

MacroMan007

New Member
Joined
Aug 5, 2005
Messages
35
Hi Georgiboy,

Thanks for your help, that worked perfectly! Now, I just have to get them to use the check box.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,295
Messages
5,600,785
Members
414,405
Latest member
Zaurb

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