Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Calendar Control to Insert Dates

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

--
Jill
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert dates from a userform leonidas[_55_] Excel Programming 4 August 4th 06 07:19 PM
Insert dates from a userform leonidas[_54_] Excel Programming 1 August 2nd 06 09:10 AM
Insert dates! I cant do it now! fernandosaez Excel Discussion (Misc queries) 0 February 25th 06 04:03 PM
insert dates alvin Kuiper Excel Programming 4 February 7th 06 08:07 PM
Insert Dates for Year Gladys Excel Discussion (Misc queries) 7 December 7th 05 07:07 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"