I am sure there are posts oN this but all the dtpicker posts i have seen don't seem to answer this question. In EXCEL 2010, HOW DO YOU GET THE DTPICKER ON A USER FORM TO DEFAULT TO TODAY ON OPENING THE FORM? Userform initialize with me.dtpicker.value = date doesn't work. Is it a timing thing? I have also tried userform activate. It always defaults to the last saved date or the date on the userform in vba. I would think there would be a default value in properties, but alas not so. Any help would be appreciated.
Dtpicker default to today's date on userform
- rdhdsandi
- Closed
-
-
-
Re: Dtpicker default to today's date on userform
DUH!! i was using the form name in an initialize event not the actual userform.initalize event. once i put it in the corrct place it worked fine. Thanks much fr jogging my slow brain.
-
Roy I just day the post you made sometime back. and you answered it but i was wondering where you put the code for using a datepicker in a userform to show todays date. not sure how and where to put the code.
-
I don't use the DatePicker control, but that cod would go in the Activate or Initialize event of the UserForm.
ActiveX controls are unreliable, there;s nob-ActiveX examples on my web site
-
-
Roy where would i place the above code in my code that i have. Here is my initialize code. im not sure where to put the above code in this code. this code is running a userform.
Code
Display MorePrivate Sub CommandButton1_Click() Dim lr As Long Application.ScreenUpdating = True Sheet = ComboBox1.Text If Sheet = "" Then MsgBox "Select Month", vbInformation, "Error" Exit Sub End If Sheets(Sheet).Select Set findBlank = Range("H2:H53").Find(what:="", lookat:=xlWhole) findBlank.Select ActiveCell.Value = DTPicker1.Value ActiveCell.Offset(0, 1).Value = TextBox1.Text ActiveCell.Offset(0, 2).Value = TextBox2.Text ActiveCell.Offset(0, 3).Value = TextBox3.Text
-
Can you read the Forum Rules and
1. Start your own question
2 Use Code Tags when posting code
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!