By: Shamima Sultana

In reply to inderpal singh.

Hello Inderpal Singh,

Thank you for your feedback! To achieve the format 06-Dec-24 13:03:00 in Excel without the colon between the date and time, you can use a formula to reformat it after inserting the date from date picker. Assuming your date and time are in cell A1, use:

=TEXT(A1, “DD-MMM-YY hh:mm:ss”)
This removes the colons and combines the date and time as desired.
Or you can updae the existing VBA code’s date format to format the date and time as 06-Dec-24 130300 (removing the colons between time), you can adjust the ControlTipText property in the existing code. Here’s the updated section:

Update the ControlTipText line:

Controls("C" & (i)).ControlTipText = Replace(Format(DateAdd("d", (i - Weekday((Month_Box.Value) & "/1/" & (Year_Box.Value))), _
((Month_Box.Value) & "/1/" & (Year_Box.Value))), "dd-mmm-yy hh:mm:ss"), ":", "")

Explanation:
1. The Replace function removes the colons (:) from the formatted date and time.
2. Format ensures the date is displayed in the dd-mmm-yy hh:mm:ss format before applying Replace.
3. Incorporate this into each section of the code where ControlTipText is being set.