Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put Pop-up Calendar Into Excel Form

Status
Not open for further replies.

PBAPaul

Programmer
Joined
Aug 3, 2002
Messages
140
Location
GB
Does anyone know how I might put a pop-up calendar into an Excel form so that the user can click on a calendar icon and then use the calendar to get a date?

Thanks for any help.

Paul



 
Have a look at Insert-Object In there I have a calender Control that should get you started.
 
There are:
- MS common controls 2 with MonthView control and DateTimePicker (with VB5, VB6)
- MS Calendar control (with office MS Access)
The first one look much better. I sometimes use MonthView (mv1) on a userform, with two hidden commandbuttons: cmdOK as default and cmdCancel as cancel button. The code behind the userform:
Code:
Public rCallingRange As Range

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
rCallingRange.Value = mv1.Value
Unload Me
End Sub

Private Sub mv1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date, Cancel As Boolean)
Call DispCurrDate(StartDate)
End Sub

Private Sub UserForm_Activate()
On Error Resume Next
mv1.Value = rCallingRange.Value
Call DispCurrDate(mv1.Value)
End Sub

Private Sub DispCurrDate(d As Date)
Me.Caption = Format(d, "d mmmm yyyy")
End Sub

and, for instance, implementation in worksheet module:
Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Set frmDate.rCallingRange = Target.Cells(1)
frmDate.Show
End Sub

combo
 
I still like the Calendar control referenced by MSCAL.OCX.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top