Reputation: 125
I have the following variable in my Macro:
todaydate = Year(Date) + Month(Date) + Day(Date)
How do I make the value of todayDate
to be 20150415
instead of 2034
?
Upvotes: 2
Views: 5086
Reputation: 1
ActiveSheet.SaveAs Filename:= "PO_" & Format(Now(),"yyyymmdd")
Hope this will help.
Upvotes: 0
Reputation: 19737
To concatenate it as string, you need to use &
.
Like this:
todaydate = Year(Date) & Month(Date) & Day(Date)
But this will yield: 2015415
To get what you want, try this:
todaydate = Format(Date, "yyyymmdd")
which will yield: 20150415
Upvotes: 2