Possible Duplicate:
Can’t format the date properly in VBA, Excel 2012
I am having some issue (primarily type mismatch) with a date. What I am trying to do i get they system time and then subtract 3 days in YYYMMDD format. For example, 20121204 should return 20121203. 20121203 should return 20121130. Currently, I can get the date with:
Sub dateComp()
Dim todaysDate As String
todaysDate = Format(Date, "yyyymmdd")
Debug.Print (todaysDate)
End Sub
I have tried using DateAdd and its not working. DateAdd(d, -3, todaysDate)
Does anyone have any ideas?
1 Answer