Autofilter.Sort

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
inseption86
Posts: 203
Joined: 19 Apr 2018, 00:24

Autofilter.Sort

06 Jun 2018, 14:24

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, .???)?????/
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Autofilter.Sort

06 Jun 2018, 15:55

[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
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Decar, doodles333, mikeyww and 219 guests