ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check Box Question (https://www.excelbanter.com/excel-programming/380161-re-check-box-question.html)

Andrew Taylor

Check Box Question
 
The easiest way is to make the Command Button intially disabled,
and enable it in the check box's click event:

Private Sub CheckBox1_Click()
Me.CommandButton1.Enabled = Me.CheckBox1.Value
End Sub

However this doesn't give you the message you ask for. You
can do this by:

Private Sub CommandButton1_Click()
If Not Me.CheckBox1.Value Then
MsgBox "Check the box first!"
Exit Sub
End If

MsgBox "All OK"

End Sub


Hope this helps
Andrew

Hazel wrote:
Hi All

I have a userform with several Commandbuttons there is one button that I
would like to control by a Checkbox -- in other words the user would have to
click the Check Box before the Command Button would work - and if the user
clicked on the Command Button 1st a message box would ask the user to click
the Check Box before the Command button will work. For all you experts out
there is that possible??
--
Many thanks

hazel




All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com