I want a macro to put today's date in the current cell formatted as dd-mmm-yy, e.g. 30-Oct-14.
The code I have is simple :
'ActiveCell.Value = Format(Now(), "dd-mmm-yy")'
For some reason this returns "30 Oct 14" with spaces instead of hyphens.
Similar formats work correctly. e.g
dd-mm-yy gives 30-10-14,
dd~mmm~yy gives 30~Oct~14
The cells actual value is set to "10 30 2014"
Can anyone give me a simple workaround, and if possible, explain why this is happening?