I want to compare two columns and copy the 4 cells found next to the comparing value found in column 1, this row should than be copied into column 2 in the first empty row.
Sub Find_Matches()
Dim CompareRange1 As Variant, CompareRange2 As Variant, x As Variant, y As Variant
' Set CompareRange equal to the range to which you will
' compare the selection.
Set CompareRange1 = Range("A1:A10")
Set CompareRange2 = Range("H1:H30")
For Each x In CompareRange1
For Each y In CompareRange2
Dim a As Variant
Set a = x.Offset(0,4)
If x = y Then y.Offset(1, 4) = a
Next y
Next x
End Sub
Set CompareRange2 = Range("H1:H30") For Each x In CompareRange1
On the same line? The For needs to be on a new line – danieltakeshi.Select
from that line. when setting you do not select. – Scott Craner