I have the following code and get a type mismatch error when comparing two ranges through a loop. When comparing the rows, the first column has a number and the other three contain strings. The idea is to find any differences between the two sheets and put them into another sheet. I changed .Value to .Text in the if statement, and it ran, but it put everything into the other sheet as though everything was different.
Code:
Set target = output.Range("B3:D3")
For i = 13 To prevws.Cells(13, 2).End(xlDown).Row
Set test = prevws.Range(prevws.Cells(i, 2), prevws.Cells(i, 5))
For w = 13 To curws.Cells(13, 2).End(xlDown).Row
Set comp = curws.Range(curws.Cells(w, 2), curws.Cells(w, 5))
[B] If test.Value = comp.Value Then[/B]
same = True
Exit For
Else
same = False
End If
Next w
If same = False Then
target.Value = test.Value
Set target = target.Offset(1, 0)
End If
Next i