I need assistance in creating macros that will sort a listbox. One macro needs to sort the dimension (asc) and one macro should sort the expression (desc). I need to be able to switch between the 2 sorts using buttons.
Hi @VivenReddy please try this macro, i used 'LB01' as Id, becasue is the id from your example qvw
Dont forget to add a 'external\ run macro' action, using the macro name
Let my know if it works
sub sort set LB = ActiveDocument.GetSheetObject("LB01") set box=LB.GetProperties if box.SortCriteria.SortByState = true then box.SortCriteria.SortByState = false else box.SortCriteria.SortByState = true end if LB.SetProperties box end sub
Thank you @Frank_Hartmann and @QFabian for your great suggestions. Unfortunately the example I posted did not match my use case. I've attached another example. See screenshot below. My listbox actually has 2 expressions and I need buttons to sort the expr 1 in ascending order and expr 2 in descending order. Is this possible?