Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1572to1576
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Filtern und Sortieren VBA

Filtern und Sortieren VBA
03.08.2017 14:54:21
Thomas
Hallo Profis,
ich habe mit mir folgendes Makro aufgezeichnet, allerdings funktioniert es nicht so wie gewünscht!
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Add Key:= _
Range("B1:B" & letztezeile), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWorkbook.Worksheets("Tabelle1").Range("A1").AutoFilter Field:=1, Criteria1:= _
">=" & CLng(CDate(Format(Date, "dd.mm.yyyy")))
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Add Key:= _
Range("A1:A" & letztezeile), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Und zwar soll er mir das Datum auf heute + Zukunft begrenzen und natürlich aufsteigen sortieren und in Spalte B soll er mir das ebenfalls aufsteigend sortieren.
Beispiel:
01.01.2017 AA
01.01.2017 BB
02.01.2017 AA
02.01.2017 BB
Bin für jede Hilfe dankbar.
Thomas

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Filtern und Sortieren VBA
03.08.2017 17:46:03
MB12
Hallo Thomas,
zeichne mal das Makro auf, wenn du über
sortieren - benutzerdefiniert - dann 2 Ebenen definieren
gehst.
Gruß, Margarete
AW: Filtern und Sortieren VBA
03.08.2017 18:17:07
Thomas
' Makro1 Makro
'
'
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Add Key:= _
Range("B1:B539"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Range("$A$1:$K$545").AutoFilter Field:=1, Criteria1:= _
">=03.08.2017", Operator:=xlAnd
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort.SortFields.Add Key:= _
Range("A1:A545"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Tabelle1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
so schaut das Modul aus wenn alle nacheinander bei einer aufzeichnung eingegeben wird.
Anzeige

248 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige