CheckBox in userform

  • Thread starter Thread starter MD
  • Start date Start date
M

MD

I'm building a UserForm that has CheckBoxes (called say CB1). The code that
I want to inclued is when CB1 is chcked do this else do that. My start off
bub looks klike this.... but it doesn't work!!!!

Private Sub Bouton_print_Click()

If CB1.Value = True Then
'.... do this
Else
'.... do that
End If
End Sub


Reagrds,

MD
 
Hi MD

This is working for me with a button with the name "CommandButton1"
and a checkbox with the name "Cb1"

Private Sub CommandButton1_Click()
If Me.Cb1.Value = True Then
MsgBox ".... do this"
Else
MsgBox ".... do that"
End If
End Sub
 
Are you sure the button is called Bouton_print?

This is a simpler version of your code that works

Private Sub Bouton_print_Click()
MsgBox IIf(CB1, "Do this", "Do that")
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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