A
anon
Hi all,
I've tried numerous combinations of selection.sort in my code however
none are working. I'm stumped however believe maybe have spotted a
possible cause. My code is showing the word SORT in capitals (non
defaulting to normal text as expected). I thought this may be because
somewhere in my personal wb or the current open wb I had stupidly
named a sub SORT however cannot find anything.
Please see the code I have tried below, any help would be much
appreciated;
ActiveSheet.Range("A2:ad" & ro + 1).SORT Key1:=Range("c2")
or
ActiveSheet.Range("A1:ad" & ro + 1).Select
Selection.SORT Key1:=Range("C1"), Order1:=xlDescending,
Header:=xlYes,
OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom
The code does not error, just does not sort the selected range. I have
looked at sort code in another workbook and that is NOT in capitals. I
have checked and there are no macros/modules containing any code in my
personal wb, (and I have no other wb's open) also the word SORT does
not appear anywhere else in my code (eg. I have not been silly enought
to Dim SORT).
I'd appreciate it if anyone can spot my (no doubt stupid) error!
I've tried numerous combinations of selection.sort in my code however
none are working. I'm stumped however believe maybe have spotted a
possible cause. My code is showing the word SORT in capitals (non
defaulting to normal text as expected). I thought this may be because
somewhere in my personal wb or the current open wb I had stupidly
named a sub SORT however cannot find anything.
Please see the code I have tried below, any help would be much
appreciated;
ActiveSheet.Range("A2:ad" & ro + 1).SORT Key1:=Range("c2")
or
ActiveSheet.Range("A1:ad" & ro + 1).Select
Selection.SORT Key1:=Range("C1"), Order1:=xlDescending,
Header:=xlYes,
OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom
The code does not error, just does not sort the selected range. I have
looked at sort code in another workbook and that is NOT in capitals. I
have checked and there are no macros/modules containing any code in my
personal wb, (and I have no other wb's open) also the word SORT does
not appear anywhere else in my code (eg. I have not been silly enought
to Dim SORT).
I'd appreciate it if anyone can spot my (no doubt stupid) error!