DatePickers and userforms

PMRetired2012

Board Regular
Joined
Aug 6, 2019
Messages
123
I have a userform that i used the multipage tool that has that has 5 tabs. in those 5 tabs i have 5 datepickers. what i want to do is write code on the form initialization part (or where ever it needs to go) of the code to where the current date shows up in datepicker on each tab. im not how to get all those datepickers to default to the current date. If i need to put in some code let me know what it is and how to put into the ionization code if that is where it goes or if i can do that from the properties of that particular datepicker
Just a side note if i couldnt get default datepicker to work would it be possible to ge the datepicker to allow me to insert the current date?

Dennis
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Untested, and a bit "schooolboy" but...

NB test on a COPY of your work first:

VBA Code:
Private Sub UserForm_Initialize()
Me.DTPicker1.Value = Date()
Me.DTPicker2.Value = Date()
Me.DTPicker3.Value = Date()
End Sub
etc...
Obviously, change the names of your datepickers, to suite.
 
Upvote 0
Untested, and a bit "schooolboy" but...

NB test on a COPY of your work first:

VBA Code:
Private Sub UserForm_Initialize()
Me.DTPicker1.Value = Date()
Me.DTPicker2.Value = Date()
Me.DTPicker3.Value = Date()
End Sub
etc...
Obviously, change the names of your datepickers, to suite.
This didnt work out for some reason
 
Upvote 0
Please say WHY it "didn't work out."
you need to explain where you put the code, and what actually happened when you ran it; did it error, in which case, what was the error code/message?
Did it run, but nothing happened?
Did it run, but something undesirable happened? ...
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,569
Members
449,038
Latest member
Guest1337

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