Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I add a date picker to a text box in a  userform in Excel 2007

Posted on 2014-12-17
11
Medium Priority
?
4,841 Views
Last Modified: 2014-12-18
How do I add a date picker to a text box in a  userform in Excel 2007
0
Comment
Question by:bjfulkerson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40506019
What do you mean when you say "add a date picker to a text box"? Do you mean that you want the result of the selection in a date picker to appear in a textbox?
0
 

Author Comment

by:bjfulkerson
ID: 40506780
I want to be able to pick a date from a calendar and populate a text box with that date.
0
 
LVL 24

Expert Comment

by:Eirman
ID: 40506787
Here's a few links explaining how to place an ActiveX date picker control into an Excel 2007 worksheet ...

http://www.fontstuff.com/excel/exltut03.htm
http://www.rondebruin.nl/win/s8/win003.htm
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bjfulkerson
ID: 40506797
Can this be done in a userForm
0
 
LVL 24

Expert Comment

by:Eirman
ID: 40506808
Can this be done in a userForm
The second link above says ...
How to Create a userform with a calendar or Date Picker control on it
So it must be possible.

You could also try this free addon ...
http://www.excel-it.com/excel_datepickers.html
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40507365
You can achieve what you want by following these steps:

1.    Go to the Visual Basic IDE
2.    Select or add your userform
3.    If the Toolbox does not appear then click 'View' in the menu bar and select 'Toolbox'
4.    Right-click on the Toolbox and select 'Additional Controls...'
5.    If 'Selected Items Only' is checked, un-check it.
6.    Scroll down to 'Microsoft Date and Time Picker' control and select it.
7.    The control will now be in the toolbox and you can then select it and draw the control on your userform
8.    Finally, add this code

Private Sub DTPicker1_Change()
TextBox1.Text = DTPicker1.Value
End Sub

Open in new window

0
 

Author Comment

by:bjfulkerson
ID: 40507417
I am on Excel 2007, and I do not see that option.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40507432
I'm not sure which "option" you mean, so please explain. But here is a demo workbook that shows the results of the above steps.
Q-28582649.xls
0
 

Author Comment

by:bjfulkerson
ID: 40507439
I got it to work.  

Private Sub Calendar1_Click()
TxtDate.Text = Calendar1.Value
End Sub
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40507452
I suggest you use the Change event instead.

Private Sub Calendar1_Change()
TxtDate.Text = Calendar1.Value
End Sub

Open in new window


But in any case I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
 

Author Comment

by:bjfulkerson
ID: 40507464
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question