Hello -
So I'm a little less experienced than I thought.
Below is my table.
My little macro orders the rows in descending order by column C, then orders the rows in descending order by Column B. But it's hard coded to 6 rows. I don't know how to make it apply to whether I have 30 records or 3,000 records. FYI, the number of columns will be fixed at 3 columns no matter how many records I have.![]()
Item Rate 1 Rate 2 A 0.60% 0.30% B 0.50% 0.40% C 0.50% 0.70% E 0.30% 0.30% F 0.20% 0.50%
Any help would greatly be appreciated.![]()
Sub Ordering_Macro() ' ' Ordering_Macro Macro ' ' ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _ ("C2:C6"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _ xlSortNormal ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _ ("B2:B6"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
Thanks for your help in advance.
- DyingIsis![]()
Bookmarks