1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Sub Test()
Dim PlageFe1 As Range
Dim PlageFe2 As Range
Dim CelFe1 As Range
Dim CelFe2 As Range
Dim Tb
Dim I As Integer
Dim DerCol As Long
With Worksheets(1)
Set PlageFe1 = .Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp))
End With
With Worksheets(2)
Set PlageFe2 = .Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp))
DerCol = .Cells(1, Columns.Count).End(xlToLeft).Column
End With
For Each CelFe2 In PlageFe2
Tb = Split(CelFe2.Value, ",")
For I = 0 To UBound(Tb)
Set CelFe1 = PlageFe1.Find(Tb(I), , xlValues, xlPart)
If Not CelFe1 Is Nothing Then
PlageFe1.Range(PlageFe1.Cells(CelFe1.Row, 2), PlageFe1.Cells(CelFe1.Row, DerCol)).Value = _
PlageFe2.Range(PlageFe2.Cells(CelFe2.Row, 2), PlageFe2.Cells(CelFe2.Row, DerCol)).Value
Set CelFe1 = Nothing
End If
Next I
Next CelFe2
End Sub |
Partager