ich habe eine Tabelle in der drei Spalten sortiert werden sollen.
Es befinden sich ca 600 Zeilen in dem Tabellenblatt.
Allerdings dauert die Sortierung ca 30 sec.
Geht das auch schneller ?
Hier der Code
Private Sub Worksheet_Activate()
Dim wksEingabe As Worksheet
Set wksEingabe = ActiveWorkbook.Worksheets("Eingabe")
With wksEingabe
.Activate
'Prüfen, ob der Autofilter schon aktiv ist
If .AutoFilterMode = True Then
If .FilterMode = True Then
' .ShowAllData
End If
Else
.Range("A2:AD2").Select
Selection.AutoFilter
End If
End With
With wksEingabe.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add Key:=wksEingabe.Range("A2"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With wksEingabe.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add Key:=wksEingabe.Range("D2"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With wksEingabe.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add Key:=wksEingabe.Range("B2"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub