Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate button macro if condition not met
Hi,
This is probably simple, but I am getting stuck with it. I have a button with an attached macro. Cell A1 sets the permission that allows the macro to run or not run as follows: If Cell A1 is 1 the macro may continue to run. If Cell A1 is 0 the macro may not run further and a popup alert should say, "Stop! Button may not be used on this page." I don't want to use data validation's conditional alert, because it would cause a popup when the page opens and not when the user selects the button mentioned above. I'm trying If, Then, End if statements, but keep getting error messages. Thank you for helping. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate button macro if condition not met
Hi
How about something like this; If Range("A1").Value = 1 Then 'Run your code Else MsgBox "Stop! Button may not be used on this page." Exit Sub End Sub Take care Marcus |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate button macro if condition not met
Thank you.
Will try it out. Appreciate the help. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deactivate button macro if condition not met
Thank you Marcus,
I had to add in an End if, and it works. If Range("A1").Value = "" Then 'Run your code Else: MsgBox "Stop! Button may not be used on this page." Exit Sub End If End Sub -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
activate/deactivate the scroll button by vba | Excel Programming | |||
Deactivating a Forms macro button based on a worksheet condition? | Excel Discussion (Misc queries) | |||
deactivate macro or LostFocus | Excel Programming | |||
activate/deactivate button with macro at given condition | Excel Programming | |||
Remove Userform Deactivate Button | Excel Programming |