L
Lostguy
For Excel 2003,
I have a worksheet with two cells that have dates in them (f2 and
f11).
I insert the Calendar Control Object in the worksheet and insert this
code for that worksheet:
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
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("f2,f11"), 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
When you select f2 or f11, the calendar pops up. When you come off
those cells, the calendar goes away. Good.
But when I protect the sheet, the control stays visible all the time.
Any help on making this work on a protected sheet? Thanks!
VR/
Lost
I have a worksheet with two cells that have dates in them (f2 and
f11).
I insert the Calendar Control Object in the worksheet and insert this
code for that worksheet:
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
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("f2,f11"), 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
When you select f2 or f11, the calendar pops up. When you come off
those cells, the calendar goes away. Good.
But when I protect the sheet, the control stays visible all the time.
Any help on making this work on a protected sheet? Thanks!
VR/
Lost