S
Shane
I have this code in an excel sheet, it brings up a calendar when I click a
cell in the range A1:A20, I can then click on a date and it populates the
cell selected with that date.
Problem is, I need this to apply to range C1:C20 and G1:G20, got any idea
how I can add the extra ranges in?
Thanks
Shane
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "dd/mm/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("A1:A50"), 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
cell in the range A1:A20, I can then click on a date and it populates the
cell selected with that date.
Problem is, I need this to apply to range C1:C20 and G1:G20, got any idea
how I can add the extra ranges in?
Thanks
Shane
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "dd/mm/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("A1:A50"), 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