Hi Everyone,
I have a sheet where there is reset button to reset all the values of textbox and combobox when clicked. However, for datetimepicker when I am setting it to null , it is giving an error.
Below is my code:
Private Sub CommandButton11_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Are you sure you want to reset?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Dim tbx As OLEObject
For Each tbx In ActiveSheet.OLEObjects
If TypeName(tbx.Object) = "TextBox" Then
tbx.Object.Text = ""
ComboBox1.Value = Null
DTPicker.Value = " "
End If
Next
End Sub
I have tried using DTPicker.Value = Null, but gives an error.
Please help
I have a sheet where there is reset button to reset all the values of textbox and combobox when clicked. However, for datetimepicker when I am setting it to null , it is giving an error.
Below is my code:
Private Sub CommandButton11_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Are you sure you want to reset?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Dim tbx As OLEObject
For Each tbx In ActiveSheet.OLEObjects
If TypeName(tbx.Object) = "TextBox" Then
tbx.Object.Text = ""
ComboBox1.Value = Null
DTPicker.Value = " "
End If
Next
End Sub
I have tried using DTPicker.Value = Null, but gives an error.
Please help