add a dropdown calendar to a worksheet?

  • Thread starter Thread starter rongripon
  • Start date Start date
R

rongripon

I would like to use a simple method to add a dropdown calendar to a worksheet
 
Here is some code I have in a worksheet module:

Private Sub Calendar1_Click()
ActiveCell.NumberFormat = "m/d/yyyy"
ActiveCell = Calendar1.Value
Calendar1.Visible = False
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("O6"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Value = Date
Calendar1.Visible = True
ElseIf Not Application.Intersect(Range("D21:D27"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
Else
Calendar1.Visible = False
Exit Sub
End If
End Sub

Mike F
 
You can use this for a range with more areas Mike

Note: You can use this if your range is not one area
If Not Application.Intersect(Range("A1:A20,C1,E1"), Target) Is Nothing Then

See my webpage
 

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

Back
Top