ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date picker? (https://www.excelbanter.com/excel-programming/275882-date-picker.html)

Gary[_9_]

Date picker?
 
Is there a way to get a date picker control on a form or on a worksheet?


Ron de Bruin

Date picker?
 
Example for Calendar control

Do Insert-Object from the menubar and place a calendar control on your sheet.
It is possible you don't see it in the list, it is installed with Access.
So if you don't have that you possible don't have the control

Here a example to use

Place this in a Sheetmodule
If you select a cell in Column A the calendar will popup and when
you DblClick on the calendar the date will be placed in the activecell

Private Sub Calendar1_DblClick()
ActiveCell.NumberFormat = "m/d/yyyy"
ActiveCell = Calendar1
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
Else: Calendar1.Visible = False
End If
End Sub


Example for one cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("a1"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
Else: Calendar1.Visible = False
End If
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Gary" wrote in message ...
Is there a way to get a date picker control on a form or on a worksheet?





All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com