Date Picker Value to Null

shreyas17

New Member
Joined
Jul 22, 2021
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
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
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try...

VBA Code:
    With DTPicker1
        .Format = dtpCustom
        .CustomFormat = " "
    End With

Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,523
Messages
6,120,030
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top