Pop-up calendar error '1004'

A

AL

Hello everyone...

I've created a pop-up calendar into a cell in Excel worksheet, but
everytime I try to select a date from the calendar I get the following
error message:

Run-time error '1004': Unable to set the NumberFormat property of the
Range class

Here is the code I have.... Can someone please tell me what am I doing
wrong here, or how to fix this issue.. Thank you...

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


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("c17:c17"), Target) Is Nothing
Then
'(adjust for your range)
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Value = Date
Calendar1.Visible = True
Else: Calendar1.Visible = False
End If
End Sub
 

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

Top