I have tried every format I can think of to get "August 24, 2012" and I cannot.
What am I doing wrong????
Code:
Sub formatthedate()
Dim thisweek As Date
Dim lngDateFormatType As Long
lngDateFormatType = Application.International(xlDateOrder)
'Order of date elements:
'0 = month-day-year
'1 = day-month-year
'2 = year-month-day
'Just checking to be sure -- mine returns a 0!!!!!
Range("a3").Value = lngDateFormatType
thisweek = Right(Range("a14"), 10)
Range("d4").Value = Format(thisweek, "mmmm dd, yyyy")
Range("d5").Value = Format(thisweek, "mmm dd, yyyy")
Range("d6").Value = Format(thisweek, "Long date")
Range("d7").Value = Format(thisweek, "general date")
Range("d8").Value = Format(thisweek, "medium date")
End Sub
Output:
0 (in A3)
(Starting in D4)
24-Aug-12
24-Aug-12
Friday, August 24, 2012
8/24/2012
24-Aug-12
A14:
Week Ending 2012-08-24
Have tried `format(thisweek, "mmmmmmmmm dd, yyyy") and get AugustAug8 24, 2012!
Any help is greatly appreciated.
Thanks very much,
Deb
What am I doing wrong????
Code:
Sub formatthedate()
Dim thisweek As Date
Dim lngDateFormatType As Long
lngDateFormatType = Application.International(xlDateOrder)
'Order of date elements:
'0 = month-day-year
'1 = day-month-year
'2 = year-month-day
'Just checking to be sure -- mine returns a 0!!!!!
Range("a3").Value = lngDateFormatType
thisweek = Right(Range("a14"), 10)
Range("d4").Value = Format(thisweek, "mmmm dd, yyyy")
Range("d5").Value = Format(thisweek, "mmm dd, yyyy")
Range("d6").Value = Format(thisweek, "Long date")
Range("d7").Value = Format(thisweek, "general date")
Range("d8").Value = Format(thisweek, "medium date")
End Sub
Output:
0 (in A3)
(Starting in D4)
24-Aug-12
24-Aug-12
Friday, August 24, 2012
8/24/2012
24-Aug-12
A14:
Week Ending 2012-08-24
Have tried `format(thisweek, "mmmmmmmmm dd, yyyy") and get AugustAug8 24, 2012!
Any help is greatly appreciated.
Thanks very much,
Deb