ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with debug "drop down calendar" (https://www.excelbanter.com/excel-programming/316120-help-debug-drop-down-calendar.html)

Rusty[_3_]

help with debug "drop down calendar"
 
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



Ron de Bruin

help with debug "drop down calendar"
 
Hi rusty

Have you add a Calendar control on your sheet first ?
Is the name of that control "Calendar1"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rusty" wrote in message ...
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





Rusty[_3_]

help with debug "drop down calendar"
 
I must of missed that, I redid it and it works great. Thank You


"Ron de Bruin" wrote in message
...
Hi rusty

Have you add a Calendar control on your sheet first ?
Is the name of that control "Calendar1"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rusty" wrote in message

...
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







Rusty[_3_]

help with debug "drop down calendar"
 
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 the

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


"Ron de Bruin" wrote in message
...
Hi rusty

Have you add a Calendar control on your sheet first ?
Is the name of that control "Calendar1"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rusty" wrote in message

...
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







Ron de Bruin

help with debug "drop down calendar"
 
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



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rusty" wrote in message ...
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 the

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


"Ron de Bruin" wrote in message
...
Hi rusty

Have you add a Calendar control on your sheet first ?
Is the name of that control "Calendar1"

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rusty" wrote in message

...
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










All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com