I have the following code:
For rowIndex = rowOffset To 15
Dim currentDate As Date
Dim nextRowDate As Date
currentDate = Cells(rowOffset, colIndex).Value
nextRowDate = Cells(rowIndex + 1, colIndex).Value
Dim currentYear As Date
currentYear = DatePart("yyyy", currentDate)
Dim nextYear As Date
nextYear = DatePart("yyyy", nextRowDate)
If currentYear <> nextYear Then
Call RenderYearStyle(rowIndex, colIndex)
Else
Call ClearStyle(rowIndex, colIndex)
End If
Next rowIndex
Date Part or "Year" functions are not returning the year part of the date. Any ideas?