drop down date

K

kalasha

i am trying to enter a drop down date in an excel worksheet for users to
select a date from a calander.

ex. select a cell (where the date is to be) and a calander pops up and the
user selects the date from the calander.

thank you,
 
N

NoodNutt

Kalasha

Right click on the sheeta tab and copy this code in:

Change the range to suit your requirements

Dim CurrentDTPickerCell As Range

Private Sub DTPicker1_CloseUp()
CurrentDTPickerCell.Value = DTPicker1.Value
DTPicker1.Visible = False
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Range("F5:F2004")) Is Nothing Then
Cancel = True
Set CurrentDTPickerCell = Target
DTPicker1.Visible = True
DTPicker1.Top = Target.Top
DTPicker1.Left = Target.Left + Target.Width + 1
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F5:F2004")) Is Nothing Then
If DTPicker1.Visible Then DTPicker1.Visible = False
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If DTPicker1.Visible Then DTPicker1.Visible = False
End Sub


In the Insert Controls Menu, choose Date/Time Picker and insert it anywhere
on your sheet.

Double click on the cell(s) or any cell within the range you have specified
in the code and click on the arrow down to bring up the callendar.

HTH
Mark.
 

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

Similar Threads


Top