Thank you very much. That's work
Posts by peterkin
-
-
Hi all, I have a question when using sorting function in VBA.
I have a table which have around 30 rows.
I would like to sort the date of 10 rows within the table (say row 11-20 only) and do not want to affect other rows.
I created the following commend in VBA but fail to do so.
Code
Display MoreSub Test() With ActiveSheet.Sort.SortFields .Clear .Add Columns(3), Order:=xlAscending .Add Columns(2), Order:=xlDescending .Add Columns(1), Order:=xlAscending End With With ActiveSheet.Sort .SetRange ActiveCell .Header = xlNo .MatchCase = False .Apply End With
I selected rows 11-20 but it sorted the whole table.
How can I fix it?
Thank you
Kin