using a macro to change the date of a Datepicker

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
82
I have a worksheet that when a user completes they click on a button and the data is copied, pasted, and all the fields reset to blank except the DatePicker
is there something I can do to call the DatePicker to reset itself back to 1/1/2019?
I've been looking all over and I have found examples of using a ComboBox to call a sub but I can't find anything that flows the other way.
I would just like to be able to set the DatePicker back to 1/1/2019 once the macro has completed.
Thanks.
 

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,099
Hi,
I am not sure if I uderstood you correctly.. but why don't you use the Userform_Initialize Event

Code:
Private Sub UserForm_Initialize()
    Me.DTPicker1.Value = #1/1/2019#
End Sub
so when the code to copy is complete then close the form and load it again.
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
613
Office Version
2016
Platform
Windows
I have a worksheet that when a user completes they click on a button and the data is copied, pasted, and all the fields reset to blank except the DatePicker
is there something I can do to call the DatePicker to reset itself back to 1/1/2019?
I've been looking all over and I have found examples of using a ComboBox to call a sub but I can't find anything that flows the other way.
I would just like to be able to set the DatePicker back to 1/1/2019 once the macro has completed.
Thanks.
can you please post the datepicker/macro using the code tags so whoever can help you can see what they're working with?
as well as any sheet names, object names, etc that would be useful

are you using the activex datepicker?

perhaps this article can help you?
https://www.ablebits.com/office-addins-blog/2016/10/12/insert-calendar-excel-datepicker-template/
 

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
82
sheet name is Form
DatePicker7 (ActiveX)
We re not permitted to use ablebits

I don't have a macro yet that is what I was hoping to get

I have no problem using the DatePicker or coding it to do what i need.

Is there a way I can Call the DatePicker to Change from the macro below?

I want to reset it to date 01/01/2019

Sub Field_Resets()
' Reset form values to staring points
Range("B2").Value = ""
Range("B8.B11").Value = ""
Range("B14").Value = "Start Here - Use Dropdown to make selection"
Range("B17").Value = "Start Here - Use Dropdown to make selection"
Range("B23").Value = ""
Range("B24").Value = "Start Here - Use Dropdown to make selection"
Range("B26").Value = "Start Here - Use Dropdown to make selection"
Range("B27.B28").Value = ""
Range("B30.B31").Value = "N/A"
Range("B33").Value = ""
Range("B34").Value = "N/A"
Range("C6.E6").Value = ""
Range("C9").Value = "Make Selection"
Range("D9").Value = "Make Selection"


End Sub
 

Forum statistics

Threads
1,082,369
Messages
5,365,047
Members
400,819
Latest member
Gossow

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top