Reputation: 7956
Dim dt1 As Date
dt1 = Date
MsgBox dt1 ' works - 12.10.2012
Day(dt1) = 1 ' error: object required
I need 1.10.2012
So, for any date, I need to set dt1 as first day of that specific date.
Upvotes: 3
Views: 4924
Reputation: 175748
You could also deduct the days directly
dt1 = dt1 - Day(dt1) + 1
Upvotes: 3
Reputation:
You could use dateserial to reconstruct a date
eg
newDate = DateSerial(Year(dt1), Month(dt1), 1)
Upvotes: 7