Sub Find_Telefon() Dim Tel As Object, Arr(), i&, Cel As Range, a Set Tel = CreateObject("Scripting.Dictionary") Arr = Range("D4:E17") For i = 1 To UBound(Arr) Tel(Arr(i, 1) & "") = Arr(i, 2) Next For Each Cel In Range("A4", Cells(Rows.Count, 1).End(xlUp)) a = Split(Cel.Value, ",") For i = 0 To UBound(a) If Tel.exists(Trim(a(i))) Then Cel.Offset(0, 1) = Tel(Trim(a(i))) Exit For End If Next Next End Sub
[/vba]
[vba]
Код
Sub Find_Telefon() Dim Tel As Object, Arr(), i&, Cel As Range, a Set Tel = CreateObject("Scripting.Dictionary") Arr = Range("D4:E17") For i = 1 To UBound(Arr) Tel(Arr(i, 1) & "") = Arr(i, 2) Next For Each Cel In Range("A4", Cells(Rows.Count, 1).End(xlUp)) a = Split(Cel.Value, ",") For i = 0 To UBound(a) If Tel.exists(Trim(a(i))) Then Cel.Offset(0, 1) = Tel(Trim(a(i))) Exit For End If Next Next End Sub