User form with a Calendar

matthew230

Board Regular
Joined
Jan 2, 2006
Messages
152
Hi,

I am currently creating a userform for entering some details, and a couple of these are dates.

Is there a method of having a calendar pop up when the box is clicked on, and thereafter enter the date selected. ???

Many thanks,

matt
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hi Matt,
Here's something I use that may help get you started.
It'll likely require adding the Calendar Control to the toolbox in your vba editor.
In the vba editor, make sure the toolbox is showing and then go to
Tools > Additional Controls.
Scroll down and look for Calendar Control (in my case it's Calendar Control 11.0)
and click the checkbox for it & hit OK.
You should see a new control in the toolbox labeled 'MonthView'. Click it & draw it
onto the userform. (Make it's Visible property = False if you don't want it to show
all the time.)
You'll need a button or something on the userform to make it show.
(MonthView1.Visible = True)
Then in the userform's module you can add something like this:
Code:
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
[A1].Value = Format(MonthView1, "mm/dd/yyyy")
End Sub
If you get this far you'll probably be able to take it from here.
Check it out and post back after playing with it and getting a feel for it if you still
have questions.
 

pfarmer

Well-known Member
Joined
Jul 6, 2005
Messages
550
Hi,

I am currently creating a userform for entering some details, and a couple of these are dates.

Is there a method of having a calendar pop up when the box is clicked on, and thereafter enter the date selected. ???

Many thanks,

matt

Matt,

Another poster posted the use of the Calendar Control. I found out at my work location that most of the machines did not have this control installed on their 2002 machines which set me back a little bit since I was using my own home 2003 version which had it installed. Others stated they thought it was installed with Access but I don't know for sure if this is true one way or another.

In any case I went with DTPicker which is similar and was common to all the machines I have been dealing with.

Thought I would mention it as an alternative and a consideration to check into.

Perry
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,023
Since there is no certainty that a pre-packaged control is installed on a target machine, I "rolled my own." See
VBA Calendar
http://www.tushar-mehta.com/excel/software/vba_calendar/index.html

Hi,

I am currently creating a userform for entering some details, and a couple of these are dates.

Is there a method of having a calendar pop up when the box is clicked on, and thereafter enter the date selected. ???

Many thanks,

matt
 

Watch MrExcel Video

Forum statistics

Threads
1,113,861
Messages
5,544,723
Members
410,630
Latest member
JFORTH97
Top