Hello everyone,
I am currently trying to create a marco that would sort the amounts in a data list from largest to smallest. My problem is this that while recording the macro, I selected a set range and now I cannot get it to expand that selection. I am not sure what to do. Below is what it currently looks like and I want to customise it so it can sort the data no matter how big the range. Please help!
Many thanks
Priyanka.
Sub Test()
'
' Test Macro
' Sorts amount
'
'
Range("A1:D8").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B2:B8"), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:D8")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("C10").Select
Bookmarks