Reputation: 491
Hi I have the following code:
dim currentDate as Date
currentDate = Format(wkSheet.Cells(3, i), "[$-F800]dddd, mmmm dd, yyyy")
Cells(3, i) is a date in short form I'm trying to convert it to a long form so for instance 7/1/2018 would become Sunday, July 1st, 2018. How to do this? The above code is based on the "record a macro" function.
Upvotes: 0
Views: 251
Reputation:
Format returns text, not a true date. Change the cell's number format.
wkSheet.Cells(3, i).NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
Note that date formats do not include st, nd, rd, th, etc. and your supplied date format is a forced two digit day (e.g. 01, not 1st)
Upvotes: 3