Try this
Sub Test()
Dim Range_A As Range
Dim Range_X As Range
Dim aBool As Boolean
Dim xBool As Boolean
Dim CompareRange_B As Variant, CompareRange_Y As Variant, A As Variant, B As Variant, X As Variant, Y As Variant
aBool = False
xBool = False
Sheets("123").Select
Set Range_A = Range("B2:Z2") '("B2:Z2") is selection A
Set Range_X = Range("A3:A10") '("A3:A10") is selction X
Set CompareRange_B = Workbooks("ABC.xlsm").Worksheets("456").Range("B3:B260") '("B3:B260") is CompareRange B
Set CompareRange_Y = Workbooks("ABC.xlsm").Worksheets("456").Range("C3:C260") '("C3:C260") is CompareRange Y
Range_A.Select
For Each A In Selection
For Each B In CompareRange_B
If A = B And B <> 0 Then aBool = True
Next B
Next A
Range_X.Select
For Each X In Selection
For Each Y In CompareRange_Y
If X = Y And Y <> 0 Then xBool = True
Next Y
Next X
If aBool = True And xBool = True Then X.Offset(0, 1) = B.Offset(0, -1)
End Sub
aelgadi
>>> If I helped, don't forget to add to my reputation (click on the at left bottom of the post)
>>> If satisfied with a solution, don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Bookmarks