OfficeUser
Well-known Member
- Joined
- Feb 4, 2010
- Messages
- 542
- Office Version
- 365
- 2016
- Platform
- Windows
I have code that will populate a cell when I select the date on the calendar control. Is there a way to allow me to select multiple dates and have the cell format such as for example: March 15, 16, 17, 18, 2011. Or even something similar.
Here is the current code:
Here is the current code:
Code:
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "mm/dd/yyyy"
ActiveCell.Select
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("B5"), 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