Enable and disable buttons

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
Can you use criteria to enable and disable buttons? (other than If statement that pops up a message box)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I think we would need more details as to what you are trying to do, but one typically enables/disables buttons on a Form via VBA code, often in the Event Procedures (On_Load, AfterUpdate, etc).
 
Last edited:
Upvote 0
I want it to be disabled if two Text Boxes are null. The action the button takes requires data in these two fields
 
Upvote 0
What I would do is put VBA code in the Load event of the Form that checks the value in the two text boxes, and then sets it to enabled/disabled.
Then, add VBA to the AfterUpdate events on each of the two text boxes that checks the value in both text boxes, and if they are both populated, enables the button.
 
Upvote 0
I would be inclined to put code in the on current event rather than on load that way each time you move records it will fire otherwise you could move from a record that meets the criteria to a record that doesn't and the button would be enabled.
 
Upvote 0
Thank you both. Any links to how to write that code?
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,327
Members
451,697
Latest member
pedroDH

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