G
Guest
In searching the posting for this user group, I found what I needed to create
a pop-up calendar in my workbook. It works fine........up to a point. When I
share the workbook I get an error message. I'm not a VBA person and wondered
if someone could offer assistance with troubleshooting the error message.
Here is the code I used to create the pop-up calendar
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("A1:A20"), 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
Else: Calendar1.Visible = False
End If
End Sub
Here is the error message I get when I share the workbook
Run-time error '1004': Unable to set the left property of the OLEObject class.
I remove this line and get the same error message unable to set "top"
I removed this line also and it works but when you scroll to bottom of the
worksheet then you can't see the caldendar when it pops up.
Any help would be much appreciated. Thanks!
a pop-up calendar in my workbook. It works fine........up to a point. When I
share the workbook I get an error message. I'm not a VBA person and wondered
if someone could offer assistance with troubleshooting the error message.
Here is the code I used to create the pop-up calendar
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("A1:A20"), 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
Else: Calendar1.Visible = False
End If
End Sub
Here is the error message I get when I share the workbook
Run-time error '1004': Unable to set the left property of the OLEObject class.
I remove this line and get the same error message unable to set "top"
I removed this line also and it works but when you scroll to bottom of the
worksheet then you can't see the caldendar when it pops up.
Any help would be much appreciated. Thanks!