Und schon wieder steh ich im Wald…
Ich versuche 4 spalten zu sortieren. Jeweils in 2 sheets. Sortiert wird dabei zuerst nach Spalte1 (Organisationseinheit) und danach nach spalte2 (Pers.Nr.). Wenn ich den code für das 2.Blatt auskommentiere funktioniert es für die erste. Wenn ich die erste auskommentiere für die 2… Aber NICHT zusammen !!! Es öffnet sich eine MsgBox von VBA mit der Sinnvollen Meldung „400“.
Hat da irgendjemand eine Idee??
Sub Sort()
With ActiveWorkbook
.Sheets(1).Columns("A:smiley:").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") \_
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= \_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 \_
:=xlSortNormal
.Sheets(2).Columns("A:smiley:").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") \_
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= \_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 \_
:=xlSortNormal
End With
Gruss,
cosPhi