help with debug "drop down calendar"

  • Thread starter Thread starter Rusty
  • Start date Start date
R

Rusty

I copy/past this code in a test and got a run time error 424.when i hit
debug it shows line "Else: Calendar1.Visible = False"this is the code i got
from http://www.rondebruin.nl/calendar.htmit was on another newsgroupe i
was watching Thanks for any and all help you can give
RustyPrivate 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
 
Hi rusty

Have you add a Calendar control on your sheet first ?
Is the name of that control "Calendar1"
 
OK here's the deal
I tried the code on a test workbook, found the insert Object/Calendar
Control 8
it works great:
then I tried it on my workbook and get: Compile error: Ambiguous name
detected:worksheet_Selection change.
I think it has to do with the code that was already there:

Private Sub Workbook_Open()
Open ThisWorkbook.Path & "\usage.log" For Append As #1
Print #1, Application.UserName, Now
Close #1
End Sub


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub
not sure what it is or if i should deleate it
Thanks for any help
 
Hi Rusty

You can have only one SelectionChange event in a worksheet module

You can delet this empty one
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

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

Back
Top