Reputation: 3357
Is it possible to manipulate the components, such as year
, month
, day
of a date
in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.
Upvotes: 3
Views: 1632
Reputation: 85224
You want DateSerial:
Dim someDate As Date = DateSerial(year, month, day)
Upvotes: 2
Reputation: 52847
DateSerial(YEAR, MONTH, DAY)
would be what you are looking for.
DateSerial(2008, 8, 19)
returns 8/19/2008
Upvotes: 6