This one has me stumped. From the bottom of a list up I evaluate the
cell in column A to the cell above it. If they match, I proceed to
evaluate the 2nd cell above, whether it matches the first. Everything
works fine if two cells don't match. But when a matching pair is found
(verified by a msgbox) it always says there is a third match...EVEN
THOUGH the two cells being compared are reported in the msgbox as
being unequal. I can't figure out any more direct to validate what VBA
is calling a match! Any ideas?
Do Until ActiveCell.Address = Range("A6130").Address
ThisRange = ActiveCell.Value
NextRange = ActiveCell.Offset(-1, 0).Value
'reset var
dupecount = 0
If ThisRange = NextRange Then
dupecount = 2
MsgBox "2 match found" & vbCrLf _
& NextRange & " " & ThisRange & vbCrLf _
& dupecount
ThisRw = ActiveCell.Row
ThisDate = ActiveCell.Offset(0, 2).Value
NextDate = ActiveCell.Offset(-1, 2).Value
NextMatch = True
GoToRow = ThisRw - 2
'see if third cell matches the first
ThirdRange = ActiveCell.Offset(-2, 0).Value
ThirdDate = ActiveCell.Offset(-2, 2).Value
If ThirdRange = ThisRange Then ThirdMatch = True
dupecount = 3
MsgBox "3 match found" & vbCrLf _
& ThirdRange & " " & ThisRange & vbCrLf _
& dupecount
GoToRow = GoToRow - 1
End If