This is a simple question that I cannot answer.
I have two columns like these in Excel:
Col1 Col2
A C
B I
C E
D D
E
without VBA
=IF(ISNA(MATCH(A1,C:C,0)),"",INDEX(C:C,MATCH(A1,C:C,0))) and copy downIn VBA
Sub Macro1()
Dim rng1 As Range
Set rng1 = Range([a1], Cells(Rows.Count, "A").End(xlUp))
rng1.Offset(0, 1).Columns.Insert
With rng1.Offset(0, 1)
.FormulaR1C1 = _
"=IF(ISNA(MATCH(RC[-1],C[1],0)),"""",INDEX(C[1],MATCH(RC[-1],C[1],0)))"
.Value = .Value
End With
End Sub