Kann mir jemand helfen.
Ich verwende eine Filter über ein Makro der mir doppelte Einträge filtert.
Die Einträge stehen in Spalte A. Vor dem filtern muss ich Spalte A markieren. Das Ergebnis steht dann in Spalte B.
Kann man die Funktion so verändern, dass man in Spalte C u. D oder E u. F....... auch den Filter
verwenden kann.
Ist es auch möglich, dass sich die Liste in Tabelle1 befindet, und man mit einer Schaltfäche von Tabelle2 aus die Liste filtern kann.
Das Makro:
Sub Onlys()
Dim arr() As Variant
Dim arrOnlys As Variant
Dim iRow As Integer, iCount As Integer
iCount = Selection.Cells.Count
If iCount = 1 Then
Beep
MsgBox "Sie müssen mindestens 2 Zellen auswählen!"
Exit Sub
End If
ReDim arr(1 To iCount)
For iRow = 1 To iCount
arr(iRow) = Selection.Cells(iRow).Value
Next iRow
arrOnlys = GetOnlys(arr)
Columns(2).ClearContents
For iRow = 1 To UBound(arrOnlys)
Cells(iRow, 2).Value = arrOnlys(iRow)
Next iRow
End Sub
Private Function GetOnlys(arr As Variant) As Variant
Dim col As New Collection
Dim arrNew()
Dim iRow As Integer
On Error Resume Next
For iRow = LBound(arr) To UBound(arr)
col.Add Item:=arr(iRow), key:=arr(iRow)
Next iRow
On Error GoTo 0
ReDim Preserve arrNew(1 To col.Count)
For iRow = 1 To col.Count
arrNew(iRow) = col(iRow)
Next iRow
GetOnlys = arrNew
End Function