“Calendar Control†to Insert Dates

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
 
D

Dave Peterson

I used Microsoft's calendar control and I don't see this effect in my tests
(also xl2003).

Maybe you could test on a brand new worksheet in a brand new workbook?

Did you use the MS calendar?
 
J

Jill

Dave:

Thanks for the prompt. I tried it again, as you suggested, and it looks fine
in 100% zoom (which was the view I created it in), but when I zoom to
anything over 100%, I am still seeing the double calendars. When I zoom to
anything under 100%, I am seeing a truncated calendar.

Any ideas?
 
R

Ron de Bruin

Yes zoom is a problem with this control

Try this

Delete the control
Change to the zoom you want
Insert the control
Save the file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


Jill said:
Dave:

Thanks for the prompt. I tried it again, as you suggested, and it looks fine
in 100% zoom (which was the view I created it in), but when I zoom to
anything over 100%, I am still seeing the double calendars. When I zoom to
anything under 100%, I am seeing a truncated calendar.

Any ideas?
 
J

Jill

Shoot, okay, thanks. That is what I found – it works perfect in the zoom it
is created in, however, when I change the zoom it gets goofy.

Thanks for the confirmation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top