I am using VBA calendar to input dates in my workbook. I have added code to my worksheet to call calendar on double click of cell. So basically when I double click cell in range I get calendar form, where I pick up the date and then it is inserted in double clicked cell. The problem is if I already have some date in cell and double click it and then just close calendar instead of picking up some date it inserts 1.1.1990 or 00:00:00. How I can make to leave existing date if I just press close?
I have used this calendar:
https://trevoreyre.com/portfolio/excel-datepicker/
Code to call calendar form by double clicking cell in range:
I have used this calendar:
https://trevoreyre.com/portfolio/excel-datepicker/
Code to call calendar form by double clicking cell in range:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim xRg As Object
If Not Intersect(Target, Range("E7:F187")) Is Nothing Then dateVariable = CalendarForm.GetDate
For Each xRg In Selection.Cells
xRg.Value = dateVariable
Next xRg
End Sub