Red over White
Board Regular
- Joined
- Jul 16, 2011
- Messages
- 109
- Office Version
-
- 2019
- Platform
-
- MacOS
Following a search of other threads, I tried the following program:
Dim Last As Long
Last = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Current").Select
With Sheets("Current").Sort
.SortFields.Clear
.SortFields.Add Key:=Range("E5:E" & Last), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SortFields.Add Key:=Range("B5:B" & Last), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SetRange Range("A5:K" & Last)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
To produce
<colgroup><col span="2"></colgroup><tbody>
</tbody>
The idea being the highest number in column E appears at the top, followed by any subsequent number that shares the same product name in Column B
Any ideas how I produce this?
Dim Last As Long
Last = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Current").Select
With Sheets("Current").Sort
.SortFields.Clear
.SortFields.Add Key:=Range("E5:E" & Last), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SortFields.Add Key:=Range("B5:B" & Last), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SetRange Range("A5:K" & Last)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
To produce
Column B | Column E |
Apples | 60000 |
Apples | 53000 |
Apples | 22 |
Pears | 55000 |
Oranges | 54000 |
Oranges | 16000 |
<colgroup><col span="2"></colgroup><tbody>
</tbody>
The idea being the highest number in column E appears at the top, followed by any subsequent number that shares the same product name in Column B
Any ideas how I produce this?