Hi,
I have a userform with a checkbox on it. In the control properties, I cleared the Value, so it does not appear to be set to True or False. I wasn't sure Excel would let me do this, but it appears to be a valid option. When I run the form, the checkbox now has a grayed out checkmark in the box, rather than being blank for False or a solid black check for True.
I would like to include this grayed out checkbox in my data validations for the userform, but I don't know what the value is to use in an If/Then. I've started writing:
If (me.checkbox.value <> True And me.checkbox.value <> False) Then
But that starts to get messy when I also need to include an clause where the checkbox equals True or it equals False.
I did try to figure it out using the following sub after doing some web research, but the "nothing" if/then turned up an "Invalid use of object" error. So, I commented it out, but the message box for the "null" if/then never popped up.
Private Sub Userform_Initialize()
If Me.checkbox.Value = Nothing Then
MsgBox "value = nothing"
End If
If Me.checkbox.Value = Null Then
MsgBox "value = null"
End If
End Sub
Does anyone know what the value of the checkbox is when it is in its grayed out, no default value state? Any help is greatly appreciated!
Bookmarks