Sort Excel list

schuegeschuege Member Posts: 3
Hello,

I'm creating an Excel list from navision. Everythings works fine, but now I want to sort the list using the autofilter.
This is the code to show the Autofilter function in the Excel sheet.
ExcelSheet.Range('A5:K5').Rows.AutoFilter;

When I record a macro in Excel and sort the list, this is the code VB creates:

Range("A5:D7").Sort Key1:=Range("A5"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

I Already tried the following code to sort the list, but is doesn't work:
ExcelSheet.Range('A5:K'+FORMAT(Row-1)).Sort(ExcelSheet.Range('A5'),1);

Does anyone know how to solve this issue?

Tnx!

Comments

Sign In or Register to comment.