-
Date Format
Hi,
I want to convert my date into the following format: from dd.01.2018 to --> January 2018
Here is the code
Code:
Dim strFormatted As String
Dim Date1 As Date
Date1 =Worksheets("Table1").Cells(1,1).Value ' here is the date given as follows dd.01.2018
strFormatted = Format(Expression:=Date1, Format:="mmm-yy")
This code returns strFormatted as dd.mmm. I dont understand why?
-
If you actually have a valid date value in worksheet Table1 cell A1, then the format string would be:
Code:
strFormatted = Format(Expression:=Date1, Format:="mmmm yyyy")
-