Ich habe ein makro geschrieben, das eine umfangreiche Tabelle nach 3 Krietrien sortiert. Dieses Makro funktioniert auf Ecxel7 einwandfrei. Sobald ich das makro unter Excel10 laufen lasse stürzt das Makro vollständig ab, Excel wird automatisch geschlossen. Manchmal aktiviert sich auch der debugger. Dann wird die Zeile .apply als Ursache für den Fehler angezeigt.
Range("Datenbereich").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets(TB_Dienstplan).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(TB_Dienstplan).Sort.SortFields.Add Key:=Range("FahrerNr"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets(TB_Dienstplan).Sort.SortFields.Add Key:=Range("Datum"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets(TB_Dienstplan).Sort.SortFields.Add Key:=Range("Beginn"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(TB_Dienstplan).Sort
.SetRange Range("Datenbereich")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'
Hat jemand Erfahrung mit diesem Problem und vielleicht auch eine Lösung dafür?
Danke Gebhard
|