I have a question, because I have a problem regarding a VBA code
I found a code that does only partially what I want.
I'm trying to highlight dates that are equal or lower then the current date (this date is on a different sheet, called Setup and the date is in cell "F3")
If there is no date in the range given no formatting should take place.
And only the range given should be highlighted, and not the rows in between the range.
Can somebody assist me with this problem, it would be highly appreciated.
Sub ChangeColor() Dim myDate As Date Dim rngCell As Range Dim lrow As Long 'format the date excluding time myDate = FormatDateTime(Now, 2) For Each rngCell In Range("C3:BB3", "C27:BB27") Select Case DateDiff("d", FormatDateTime(rngCell.Value, 2), myDate) Case Is >= 0 rngCell.Interior.ColorIndex = 44 rngCell.Font.ColorIndex = 55 Case Is = Empty rngCell.Interior.ColorIndex = 48 rngCell.Font.ColorIndex = 58 End Select Next Exit Sub End Sub