Hi Folks,
I haven't had any luck in getting my code to reformat Date from 5/14/2018 to something without the forward slash. The code I found when I searched for a solution simply doesn't work for some reason.
Here's my code showing all the iterations I've tried to reformat the Date.
The VBA editor always changes the F in Format to a lowercase and I get the error "Wrong number of arguments or invalid property assignment."
All around the web I kept finding this code
I'm stumped again in VBA. Although I did figure out the difference between Now and Date!
Thanks in advance to anyone who replies.
Cheers,
Matt
I haven't had any luck in getting my code to reformat Date from 5/14/2018 to something without the forward slash. The code I found when I searched for a solution simply doesn't work for some reason.
Here's my code showing all the iterations I've tried to reformat the Date.
Code:
Dim aDate As Date
aDate = Date ' returns 5/14/2018
' version 1
Dim myDate As String
myDate.Value = format(aDate, "yyyy-mm-dd")
' version 2
Dim myDate As String
myDate = format(aDate, "yyyy-mm-dd")
' version 3
Dim myDate As Date
myDate = format(Date, "yyyy-mm-dd")
' version 4
Dim myDate As String
myDate = format(Date, "yyyy-mm-dd")
The VBA editor always changes the F in Format to a lowercase and I get the error "Wrong number of arguments or invalid property assignment."
All around the web I kept finding this code
Code:
(variable) = Format(Date, "DD-MM-YYYY") ' or similar
I'm stumped again in VBA. Although I did figure out the difference between Now and Date!
Thanks in advance to anyone who replies.
Cheers,
Matt