Hey,
I want to control for date similarities, so End date needs to be the same or at max one bigger as Date. E.g. Date: 01.01, then the end date can either be 01.01 or 02.01
The columns start with B2 and C2, with the title as a part of it
I tried to make it below, but it doesn't colour B6 and C6, as it should.... Any suggestions?
The loop should be working until it hits a blank cell
Thanks in advance
I want to control for date similarities, so End date needs to be the same or at max one bigger as Date. E.g. Date: 01.01, then the end date can either be 01.01 or 02.01
The columns start with B2 and C2, with the title as a part of it
End date | Date |
01.01 | 01.01 |
02.01 | 01.01 |
01.01 | 01.01 |
03.01 | 01.01 |
I tried to make it below, but it doesn't colour B6 and C6, as it should.... Any suggestions?
The loop should be working until it hits a blank cell
VBA Code:
Sub Comparing()
Dim row_one As Integer
Dim row_two As Integer
row_one = 3
row_two = 3
Do While Range("B" & row_one).Value <> "" And Range("C" & row_two).Value <> ""
If Range("B" & row_one).Value < Range("C" & row_two).Value Then
Range("B" & row_one).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 555
.TintAndShade = 0
.PatternTintAndShade = 0
Range("J3").Select
End With
Else
Range("B" & row_one).Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If
row_one = row_one + 1
row_two = row_two + 1
Loop
End Sub
Thanks in advance
Last edited by a moderator: