Checkbox Lock

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am a new programmer in excel. I need lock the checkbox after checkbox
checked. I tried use property locked, enabled no one works. I used click
event. Need help. Thanks.
 
Maybe you could just disable it from future use:

Option Explicit
Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.CheckBox1.Enabled = False
End If
End Sub
 
But I'd hate to see that (as a user). I often click on the wrong checkbox and
have to correct it.
 
Hi Leanne,

Adapting Dave's code to acknowledge his warning, perhaps try:

Private Sub CheckBox1_Click()
Dim res As Long
If Me.CheckBox1.Value = True Then
res = MsgBox("Are you sure you meant to " & _
"check this option?", vbYesNo, "Please Confirm")
If res = vbYes Then
Me.CheckBox1.Enabled = False
Else
Me.CheckBox1.Value = False
End If
End If

End Sub

This throws up a message box if the user checks the box and asks for
confirmation. Annoying, if the box was intentionally checked, but less
annoying, perhaps, than being unable to undo an unintentional click.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top