Hello,
I am trying to compare below two columns, one number from first column equals the sum of two numbers from second column. You may notice that 11.90=7.49+4.41
Col 1 Col 2
70.26 85.4
69.17 7.49 <-
93.98 4.41 <-
11.90 <- 47.83
17.06 77.80
52.95 79.65
below is the script I designed trying to highlight 11.90, but seems not working. Could someone take a look at this?
Sub compare1to2()
Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 2 To 7
For j = 2 To 6
For k = j + 1 To 7
If Range(i, 1).Value <> "" Then
If Range(i, 1).Value = Range(j, 2).Value + Range(k, 2).Value Then
Cells(i, 1).Interior.Color = RGB(255, 255, 0)
Exit For
End If
End If
Next k
Next j
Next i
End Sub
Bookmarks