I want to produce todays date like this: 01/23/2016 month/day/year. I wrote the below code but the result is 23/01/2016. Can anyone help me? Thanks
ActiveSheet.Cells(1, 2) = Format(Date, "mm/dd/yyyy")
The code you use enters something into an Excel cell. Excel recognises that it is a date and will display the date according to the default settings.
In order to display the date with your preferred format, you need to format the cell that displays the date, not the data entry string.
ActiveSheet.Cells(1, 2) = Date
ActiveSheet.Cells(1, 2).NumberFormat = "mm/dd/yyyy"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With