how to debug.print datepicker value

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
As the title states, how do I get the value of the date picker by debug.print.

Thank you
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Code:
Private Sub DTPicker1_Change()
    Debug.Print "Date selected: " & DTPicker1.Value
End Sub
put this in the code module of the parent object (a Sheet or an UserForm) of the DTPicker and adjust the picker object name.
The result of the code can be found in the Immediate window of VBE (alt+F11 -> Ctrl+G)
 
Last edited:
Upvote 0
Now I am wondering? Is it possible to format a DTPicker value without the forward slashes? i.e. 03122019 or 3122019. Thank You.
 
Upvote 0
Code:
Private Sub DTPicker1_Change()
    Debug.Print "Date selected: " & Format(DTPicker1.Value, "ddmmyyyy")
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,826
Members
449,051
Latest member
excelquestion515

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