-
DateDiff assistance
So I need some help debugging some code. I'm trying to create a macro that updates the years since a date that is given in column 16 of each row then placing that number of years in row Sub dateUpD8()
x = 3
Do Until Cells(x, 16).Value = ""
d = Cells(x, 16).Value
fromDate = CDate(d)
toDate = CDate(Now)
Cells(x, 27).Value = DateDiff("y", fromDate, toDate)
x = x + 1
Loop
End Sub
What am I doing wrong?
-
Re: DateDiff assistance
Try
Code:
Cells(x, 27).Value = DateDiff("yyyy", fromDate, toDate)
Else maybe you should tell us what problem you are having.