[quote="inseption86"]Hi, please help
how it will look for ahk ?:
ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range ("A:A"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= xlSortNormal
ActiveSheet.AutoFilter.Sort.Apply
[codexl.ActiveSheet.Range("A2:AA2").AutoFilter(2, .???)?????/
Code: Select all
[/quote]In AHK you cannot use named parameters. You just have to put them in the correct slot for the method.
[url]https://msdn.microsoft.com/en-us/vba/excel-vba/articles/sortfields-add-method-excel[/url]
expression . Add( Key , SortOn , Order , CustomOrder , DataOption )
Also you can not use predefined constant variables like xlSortOnValues. You have to google those and put in the actual number value those represent.
Something like [c]xlApp.ActiveSheet.AutoFilter.Sort.SortFields.Add(xlApp.Range("A:A"), 123, 456, 789, 012)[/c]
I just put in dummy values for the constants. You will have to look them up. It is also important to realize that Key requires a range object, not just a string range address.
FG