Hi all,

I recorded a macro to sort out data in reverse order, the only problem I still have, is to make it interactive so it includes and sorts as many columns as the sheet might have. Data can be in just column A, or take as many columns as going to AG, with an always changing number of rows.

Below is the part of the code I need help with (where I set up the range to Z500 in the meantime), I'd like the macro to include whatever number of rows and columns. I'll appreciate any help!

ActiveSheet.SORT.SortFields.Clear
ActiveSheet.SORT.SortFields.Add Key:=Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal

With ActiveSheet.SORT
.SetRange Range("A1:Z500")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply