I'm using a Datepicker solution presented here Formatting MM/DD/YYYY dates in textbox in VBA
I can run it from a Sub
, but is it possible to run it from clicking on specific cells?
I'm using a Datepicker solution presented here Formatting MM/DD/YYYY dates in textbox in VBA
I can run it from a Sub
, but is it possible to run it from clicking on specific cells?
You can use the Worksheet_BeforeDoubleClick
event on your worksheet and only fire the code when a specific cell (or cells) are double-clicked.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$C$2" Then UserForm1.Show `change to desired cell address and the name of your userform
End Sub
this code should be placed in the Worksheet
module
Here is the documentation for the events https://msdn.microsoft.com/en-us/library/office/dn301178.aspx