DatePicker Control to default to first day of year current year

bilbo85

New Member
Joined
Dec 8, 2015
Messages
19
Hi,

I have a datepicker control in my userform that currently defaults to today's date using the code below. Do you know how to modify this to always show the first day of the current year?

Me.DTPicker1.Value = Date

Thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Try:

Code:
Me.DTPicker1.Value = DateSerial(Year(Date), 1, 1)

Is there a way to choose the default date to a specific date. For example I want DTPicker1 to show 12/31/9999 until a date has been chosen
 
Upvote 0
I haven't tested this, but it should work:

Code:
Me.DTPicker1.Value = DateSerial(9999, 12, 31)
 
Upvote 0
sometimes I just laugh at myself. Don't know why I make things more difficult than they have to be. Eric you ROCK! Thanks
 
Upvote 0
I know the feeling! I hate when I miss the obvious, but it happens all too often! Glad I could help. :cool:
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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