Dein Key2 ist "" dadurch Folgefehler, oder?
call ApplicationObject.Selection.Sort(xlSheet.Columns("B"), xlAscending , "", xlSheet.Columns("A"), xlAscending , xlYes,1, False, xlTopToBottom)
Dim xlsheet As Variant Dim r as Variant Set xlsheet = xl.Workbooks(1).ActiveSheet Set r = xl.Range("A2","D" & Cstr(row)) 'Sortiere r.Sort xlSheet.Cells(1, 2), xlAscending , "", xlSheet.Cells(1, 1), xlAscending , xlYes,1, False, xlTopToBottom
Dim xlsheet As Variant Dim r as Variant Set xlsheet = xl.Workbooks(1).ActiveSheet Set r = xl.Range("A2","D" & Cstr(row)) 'Sortiere r.Sort r.Cells(1, 2), xlAscending , "", r.Cells(1, 1), xlAscending , xlYes,1, False, xlTopToBottom
Columns("A:D").Select Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Key2:=Range("A2") _ , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _ :=xlSortNormal
Sub sortieren() Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Key2:=Range("B3") _ , Order2:=xlDescending, Key3:=Range("E3"), Order3:=xlAscending, Header _ :=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub
ExcelApplicationObject.run "sortieren"
Dim ex As Variant Const xlAscending = 1 Const xlGuess = 0 Const xlTopToBottom = 1 Set ex = getobject(,"Excel.Application") ex.activesheet.Range("A2","D7").Select Call ex.Selection.Sort(ex.Columns("B"), xlAscending, ex.Columns("A"), , xlAscending, , , xlGuess, 1, False, xlTopToBottom)
Call xl.Selection.Sort ( xlsheet.Columns("B"), xlAscending, xlsheet.Columns("A"),,xlAscending,,,xlYes,1,False)
xlWbk.ActiveSheet.Cells(row, 3)= {=Summe(C2:C} & row-1 & ")" xlWbk.ActiveSheet.Cells(row, 4)= {=Summe(D2:D} & row-1 & ")" xl.Columns("C:D").Select xl.Selection.NumberFormat = "#.0"
...Das Eintragen klappt, nur kommt immer #NAME? bei Excel raus. In den Feldern steht es richtig drin. ...