PDA

View Full Version : If Checkbox is checked, display message... If checkbox is unchecked, do nothing



Jlamp1234
08-18-2020, 01:36 PM
Hi,

Currently I have this code:
_____________________________________________


Private Sub CheckBox95_Click()
rsp = MsgBox("Is File Location Entered in Column J?", vbYesNo + vbInformation)
If rsp = vbYes Then
rsp = MsgBox("Please Proceed to Next Step", vbInformation)
Else
rsp = MsgBox("Please Attach File Location in Column J.", vbCritical)
End If
End Sub



___________________________________

It works if the checkbox is checked and unchecked. I would like it to only work, however, if the checkbox is checked and nothing to happen when unchecked. Any advice or code?

Thank you in advance for the help!

Logit
08-18-2020, 06:28 PM
Private Sub CheckBox95_Click()

rsp = MsgBox("Is File Location Entered in Column J?", vbYesNo + vbInformation)

If rsp = vbYes Then
rsp = MsgBox("Please Proceed to Next Step", vbInformation)
End If
End Sub

Jlamp1234
08-19-2020, 09:53 AM
Private Sub CheckBox95_Click()

rsp = MsgBox("Is File Location Entered in Column J?", vbYesNo + vbInformation)

If rsp = vbYes Then
rsp = MsgBox("Please Proceed to Next Step", vbInformation)
End If
End Sub


Thanks for the reply. It didn't actually solve the issue as the checkbox still pulls open a message when I uncheck it. Is there any other solution?

Logit
08-19-2020, 12:59 PM
.
Ok ... is this what you are searching for ?



Private Sub CheckBox95_Click()
MsgBox "Your Message Here"
End Sub

jolivanes
08-19-2020, 02:34 PM
Use code tags for your code.
Try this. Change references where required.

Private Sub CheckBox95_Click()
Dim rsp As String
If Sheets("Sheet1").CheckBox1.Value = True Then
rsp = MsgBox("Please Proceed to Next Step", vbInformation)
Else
End If
End Sub

It's an ActiveX control, isn't it?