Thread: current year
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default current year

Maybe this macro will do what you want...

Sub AddOneYearToSelection()
Dim R As Range
For Each R In Worksheets("Sheet2").Range("A2:A367")
If IsDate(R.Value) Then R.Value = DateAdd("yyyy", 1, R.Value)
Next
End Sub

Just change the worksheet and cell references (in the For..Each statement)
to whatever your actual conditions are.

--
Rick (MVP - Excel)


"Rob" wrote in message
...
I wan to create a macro which will change the dates once a year to the
current year. I have a range of dates beginning with 01/01/2008 and I
want
to change these dates to the current year and I want to be able to run
this
macro each year to update the year that is in the cells to the current
year.
I can replace code but how do I state that to replace 200* with the
current
year. Please help...Thanks in advance.