On 2002-05-07 06:48, Rocky E wrote:
This is for dwhj... or anyone else
A Double click anywhere on the workseet will activate this control, but the result is always returned to A1. The line that does this is:
ActiveSheet.Range("A1") = Calendar1.Value
How can I change this to return the value to the selected cell, the one that was double clicked in the first place.
Rocky...
There was an error in my first posting that I corrected in the second post.
Change the BeforeDoubleClick procedure to :-
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$A$1" Then
UserForm1.Show
Application.EnableEvents = False
Target.Offset(1, 0).Select
Application.EnableEvents = True
End If
End Sub
With the revised code from the first posting, the calendar will appear when A1 is selected or double clicked, and the date selected will be put in A1.
The code in the second post will display the calendar when a cell in column B is double-clicked, and the date selected will be put in the active cell.
If you need the calendar activated under some other conditions, the code needs to be adjusted accordingly. Post again if you have difficulty in changing the code.