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
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
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,029
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
 

Forum statistics

Threads
1,143,676
Messages
5,720,242
Members
422,272
Latest member
ginkgoVil

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
Top