I am looking to format a date in Excel properly using VBA. I have looked at other solutions and it hasn't helped.
I am using VBA to take an entry from the page, format it, then edit it into an SQL string that will go through to an Oracle database.
I need the date to be in DD-mmm-YYYY format, "17-Oct-2017" using today's date.
My code:
Range("A1").Select
Selection.NumberFormat = "d-mmm-yyyy"
date= UserSheet1.Cells(1, 1)
In the cell, it appears properly, but when I reference the "date" variable in my code, it appears as 10/17/2017.
DD-MON-YYYY
? Oracle accepts multiple data formats includingDD/MM/YYYY
. – MT0