by Sisyphus » Wed Jan 11, 2012 9:51 pm
Hi,
Yes. That is likely to prove stable because you leave the management of the Date entirely to Excel. Your program doesn't interfere, and the only way the user can cause a muck-up is by formatting the target cell in some way you don't like. If you want to guard against that you can set the format of the target cell.
In slow motion:
The datepicker delivers a Date. It is a date number.
The worksheet receives the Date as a number.
It interprets this Date by local Excel rules. Day, month and year are all correct.
The receiving cell is formatted by Excel as a Date automatically. Local Excel rules are applied.
The precise date format chosen is determined by the Sheet, Workbook or System defaults, whichever is applicable. Local Excel decides.
Hence, if you haven't set the required cell format anywhere the result may be unexpected and subject to occasional change. On the other hand, if you set the cell format programmatically it can't interfere with the date value because that is determined by the Datepicker and brought to the cell without modification.
Have a great day!
Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)