AW: geht bei mir. owT
12.02.2024 15:51:43
Alwin Weisangler
Hallo Danny,
eine von diversen Möglichkeiten:
Option Explicit
Sub LieferentenListen()
Dim sList As Object, i&, j, tmp
Dim arr, arrList
Set sList = CreateObject("System.Collections.sortedlist")
arr = Tabelle1.Range("A2:B" & Tabelle1.Cells(Rows.Count, 1).End(xlUp).Row)
For i = 1 To UBound(arr)
If arr(i, 1) > "" Then sList(arr(i, 1)) = ""
Next i
ReDim arrList(1 To sList.Count, 1 To 2)
For i = 0 To sList.Count - 1
arrList(i + 1, 1) = sList.GetKey(i)
Next i
For i = LBound(arrList) To UBound(arrList)
For j = LBound(arr) To UBound(arr)
If arrList(i, 1) = arr(j, 1) Then
tmp = tmp & arr(j, 2) & "; "
End If
Next j
arrList(i, 2) = Left(tmp, Len(tmp) - 1)
tmp = ""
Next i
With Tabelle1
.Range("E2:F" & Tabelle1.Cells(Rows.Count, 5).End(xlUp).Row).ClearContents
.Range("E2").Resize(UBound(arrList, 1), UBound(arrList, 2)) = arrList
End With
End Sub
Gruß Uwe