So I am new to using this VBA stuff and I keep getting a Run-Time Error '424' that says Object Required. If I click Debug, I get a yellow arrow that doesn't seem to tell me very much except that I have an error in that line but I don't know why or how to fix it.
I was hoping someone here might be able to help me. I just want a calendar to pop up whenever I click the cell B4. It sounded simple enough but things just aren't working right now.
Here is what I have in my code-- maybe you can tell me whats wrong.
Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "mm/dd/yyyy"
ActiveCell.Select
Calendar1.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("B4"), 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
If Not IsDate(Target.Value) Then
Calendar1.Value = Date
Else
Calendar1.Value = Target.Value
End If
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
Bookmarks