Can anyone tell me how to insert a pop-up Calendar within a cell that opens when you click in the cell or when you type in the first number of the date then disappears when you select a date. Much appreciated in advance.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim form As CalendarForm
Dim d As Date
If Target.Address = "$B$6" Then
Set form = New CalendarForm
d = form.GetDate(SelectedDate:=Date)
If d > 0 Then Target.value = d
End If
End Sub
That means you have two different procedures in the same module with the exact same name - that is not allowed. All procedure names must be unique within a module."Compile error - Ambiguous name detected: Worksheet_SelctionChange".
I'll try to figure it up with your info (eventhough I'm not that skilled in Excel). But, observing the pic with both codes, how would you change those for they can actually work? How do I combine them? Thank you againThat means you have two different procedures in the same module with the exact same name - that is not allowed. All procedure names must be unique within a module.
Since the "Worksheet_SelectionChange" is an event procedure that fires automatically upon a range selection, if you name the second one something else, it will NOT run automatically. You have no flexibility in naming event procedures, they MUST be named a certain way in order to run automatically.
You need to combine those two procedures with the same name into one single procedure with that name.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim form As CalendarForm
Dim d As Date
If Target.Address = "$B$6" Then
Set form = New CalendarForm
d = form.GetDate(SelectedDate:=Date)
If d > 0 Then Target.value = d
Else
Range("AG10").value = ActiveCell.value
End If
End Sub