J
Jill
Using Excel 2003, I inserted a calendar control into my worksheet and used
the following code (courtesy of Ron de Bruin) to have a calendar pop up,
where a user can select a date from the calendar and the date is then
displayed in the cell. The calendar disappears after the user clicks on a
date.
I am having a challenge with how the calendar is displayed. It actually
looks like a small calendar within a larger calendar. The small calendar
allows me to select the month/day/year and the entry is displayed in the
cell; the larger calendar is the calendar for the current date.
Any ideas why I am getting this odd display?
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "mm/dd/yyyy"
ActiveCell.Select
Calendar1.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("e2:e99"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
the following code (courtesy of Ron de Bruin) to have a calendar pop up,
where a user can select a date from the calendar and the date is then
displayed in the cell. The calendar disappears after the user clicks on a
date.
I am having a challenge with how the calendar is displayed. It actually
looks like a small calendar within a larger calendar. The small calendar
allows me to select the month/day/year and the entry is displayed in the
cell; the larger calendar is the calendar for the current date.
Any ideas why I am getting this odd display?
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "mm/dd/yyyy"
ActiveCell.Select
Calendar1.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("e2:e99"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub