Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set DTPickers Data to Todays Date by Default
I have a Userform with several DTPickers. Next to each DTPicker is a
checkbox. This is how I relate the checkbox and dtpicker, Checkbox1.Value = DTPicker1.Visible. How can I set the DTPickers date to todays date when the userform is intialized? Currently the date is the date I added it to the userform. This is what I use to get around it. Sub Userform_Initialize() ' set all dtp controls to todays date, ' if the DTPicker is not visible and you try to set the date you get an error For Each dtp In colDueDates With dtp If .Visible = False Then .Visible = True .Value = Date .Visible = False End If End With Next dtp End Sub -- Cheers, Ryan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set DTPickers Data to Todays Date by Default
Work this into your initialize
Private Sub UserForm_Initialize() ' Check if active cell contains a date. If 'yes' show ' same date on calendar. If 'no' show today's date. If IsDate(ActiveCell.Value) Then Calendar1.Value = DateValue(ActiveCell.Value) Else Calendar1.Value = Format(Date, "dd-mmm-yy") End If End Sub Gord Dibben MS Excel MVP On Mon, 20 Oct 2008 07:11:02 -0700, RyanH wrote: I have a Userform with several DTPickers. Next to each DTPicker is a checkbox. This is how I relate the checkbox and dtpicker, Checkbox1.Value = DTPicker1.Visible. How can I set the DTPickers date to todays date when the userform is intialized? Currently the date is the date I added it to the userform. This is what I use to get around it. Sub Userform_Initialize() ' set all dtp controls to todays date, ' if the DTPicker is not visible and you try to set the date you get an error For Each dtp In colDueDates With dtp If .Visible = False Then .Visible = True .Value = Date .Visible = False End If End With Next dtp End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
is there a formula that will subtract todays date from a hire date | Excel Worksheet Functions | |||
graphing data based on todays date | Excel Discussion (Misc queries) | |||
Create a button that will date stamp todays date in a cell | Excel Discussion (Misc queries) | |||
When I open my past invoice it keeps changing date to todays date | Excel Worksheet Functions | |||
Use button on sheet to transfer data based on todays date | Excel Programming |