F
FrankTimJr
I'm curious to find out if I can eliminate the Range on the below macro I
created?
I want to it to not care what Range I select, as long as the Range includes
cells from column AN (Not the entire column). Since Excel 2007 does not save
the sort parameters I need to figure out a way to automate the sort. I have
several worksheets and several seperate ranges I need to sort on. Is this
possible? I want to run the macro AFTER I select the Range I want to sort
and not have the macro select the Range.
Sub SortByColumAN()
'
' Sorts data by column AN
' Keyboard Shortcut: Ctrl+Shift+Z
'
ActiveWorkbook.Worksheets("Renewal Rate").Sort.SortFields.Add
Key:=Range( _
"AN54:AN58"), SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Renewal Rate").Sort
.SetRange Range("E54F58")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
created?
I want to it to not care what Range I select, as long as the Range includes
cells from column AN (Not the entire column). Since Excel 2007 does not save
the sort parameters I need to figure out a way to automate the sort. I have
several worksheets and several seperate ranges I need to sort on. Is this
possible? I want to run the macro AFTER I select the Range I want to sort
and not have the macro select the Range.
Sub SortByColumAN()
'
' Sorts data by column AN
' Keyboard Shortcut: Ctrl+Shift+Z
'
ActiveWorkbook.Worksheets("Renewal Rate").Sort.SortFields.Add
Key:=Range( _
"AN54:AN58"), SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Renewal Rate").Sort
.SetRange Range("E54F58")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub