I have written this example code to reporduce the error:
Sub test()
Dim rng As Range
Dim cell As Range
Set rng = ThisWorkbook.Worksheets(1).Range("C1:C3")
For Each cell In rng
If cell.Value2 = cell.Offset(-1, 0).Value2 Then
cell.Offset(1, 0) = "TRUE"
End If
Next cell
End Sub
In the line If cell.Value = cell.Offset(-1, 0).Value2 I get an Application or Object defined error but I have no idea why. Usually it should check for C1 if B1 has the same value. Maybe I am just blind. Could anyone tell me why this is not working?