It is a little unclear from your code exactly what you are trying to do
(Date is a built in function in VB), but assuming you have a real date
reference of some kind, just put it in where I show ThisYearsDate and the
DateAdd function (as structured) will add one year to that date. I show the
output being assigned to a variable named NextYearsDate, but you can output
it anywhere you need to (back into a cell, in a MsgBox, etc.)...
NextYearsDate = DateAdd("YYYY", 1, ThisYearsDate)
--
Rick (MVP - Excel)
"Philosophaie" <(E-Mail Removed)> wrote in message
news:11024AC7-5D6A-4AC5-B46D-(E-Mail Removed)...
>I would like to change to year portion from 2009 to 2010 in multiple cells.
> The cells are formatted as Date with *3/14/2001 selected
>
> for k = 1 to 5
> Sheets("Sheet1").Cells(k,2)=Date
> if Date.year = 2009 then Date.year=2010
> next k
>
> Date.year is incorrect. How do I change and save the date?
|