how disable and enable button based on cell value

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello

I have normal command button not ACTIVEX so what I want when cells value "G2" is blank then press button it seems to work but nothing happens and if the cell is "permission" then run the macro .
I know the way how do that BY BUTTON ACTIVEX but I don't want because most all the macros uses normally button if it's possible please guide me how do that .
thanks in advance
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Good day

Try the following: (I created a Button Form Control, not an Active X one quickly on a blank sheet to test and I think it works they way you describe)

Insert a module with following code:

VBA Code:
Sub Button()
    If Range("G2").Value = "permission" Then
        MsgBox "permission" 'or place here the macro you want to run
        Else: Exit Sub
    End If
End Sub

Go back to sheet.
Click Design Mode.
Right Click Button.
Assign Macro called Button to the Button.

When I test this is what it does: If G2 is empty it does nothing. If G2 contains the word permission then it gives me a MsgBox (or here you can insert the code you want to run).
 
Upvote 0
Solution

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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