Need macro to add 100 years to a cell's date
Try this
Sub Add100()
Dim myDate As Date
myDate = Range("A1").Value
myDate = DateSerial(Year(myDate) + 100, Month(myDate), Day(myDate))
Range("A1").Value = myDate
End Sub
--
HTH,
Barb Reinhardt
"aligatrjoe" wrote:
I am using Office 2003. I know how to write a formula in a new cell and set
it equal to a different cell's date plus 100 years. I can then copy new
formula and paste special to original cell. But I sure can't figure out how
to do this with a macro. I am thinking I declare a variable as myDate, set
myDate = Cell(A1), then add 100 years to myDate, then pastespecial to
cell(a1). But I can't get this to work. Any help would be greatly
appreciated.
--
Bill W
|