using a macro to change the date of a Datepicker

rholdren

Board Regular
Joined
Aug 25, 2016
Messages
140
Office Version
  1. 365
  2. 2019
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.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
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.
 
Upvote 0
it didn't work. It's just part of a worksheet not an actual user form
 
Upvote 0
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/
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,205
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