Hello from Steved
Data Sort
I use $ "Dollar"Values to sort in Column G:G ie $5.20, $11.70 and $2.70 and sort it to $2.70, $5.20 and $11.70
In row H:H I copy the numbers from E:E say 1 to 6, 1 to 15, 1 to 10,
so the column wil1 start with 1,2,3,4,5,6,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,3,4,5,6,7,8,9,10
0k looking at the above I want a script please that will only Data Sort the cells with say 1 to 6, or 1 to 15, or 1 to 10.
Meaning Data Sort 1 to 6, then Data Sort 1 to 15, and then Data Sort 1 to 10
So sorting the $ "Dollars" puts it from the lowest to the Highest
I may have over 300 rows of this do to hence a macro that will loop please
The below does what I want, however I've got to highlite the "Range".
Sub DataSort()
ActiveWorkbook.Worksheets("Sheet3").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet3").Sort.SortFields.Add Key:=Range("G2:G12") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet3").Sort
.SetRange Range("E2:G12")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E2:H12").Select
ActiveWorkbook.Worksheets("Sheet3").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet3").Sort.SortFields.Add Key:=Range("E2:E12") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet3").Sort
.SetRange Range("E2:H12")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub