Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel calendar years
Hi,
I'm trying to use the calendar tool in Forms under the VBAProject so that the years dropdown list only displays the years 2005 and 2006 (instead of all years from 1900 thru to 2100). Is there a way to limit the years to only 2005 and 2006? If not, is there a way to display an error message so that the user can be told to enter a date between 2005 and 2006 if they don't? I've got a validation check but this seems to have no effect when the date is entered using the pop-up calendar tool. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
excel calendar years
Hi
If you use it on a worksheet you can do this see also http://www.rondebruin.nl/calendar.htm Private Sub Calendar1_Click() If Year(Calendar1.Value) = 2005 Or Year(Calendar1.Value) = 2006 Then ActiveCell.Value = CDbl(Calendar1.Value) ActiveCell.NumberFormat = "mm/dd/yyyy" ActiveCell.Select Else MsgBox "Select a date in 2005/2006" End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Not Application.Intersect(Range("A1:A20"), 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 Else: Calendar1.Visible = False End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "whowatwerwyhow" wrote in message ... Hi, I'm trying to use the calendar tool in Forms under the VBAProject so that the years dropdown list only displays the years 2005 and 2006 (instead of all years from 1900 thru to 2100). Is there a way to limit the years to only 2005 and 2006? If not, is there a way to display an error message so that the user can be told to enter a date between 2005 and 2006 if they don't? I've got a validation check but this seems to have no effect when the date is entered using the pop-up calendar tool. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Grouping Dates in a Pivot table for years that are not calendar ye | Excel Worksheet Functions | |||
how do i export excel calendar info to outlook calendar? | Excel Discussion (Misc queries) | |||
How do I add an extra day to a calendar every four years | New Users to Excel | |||
excel calendar years | Excel Discussion (Misc queries) | |||
excel calendar years | Excel Discussion (Misc queries) |