I am new to VBA, but trying to create a sort button at the bottom of multiple columns that will use the column location of the Macro button pressed as the column to be sorted. (Macro button at the bottom of column E would sort using the data in column E, button at the bottom of column AA would sort using the data in column AA, and so forth).
Here is a sample of the recorded macro code. How could I specify to use the macro button at the bottom of Column E in this example?
Rows("4:14").Select
Active Sheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("E4:E14"), _
SortOn:=xlSortOnValues, Order:xlDescending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("A$:CV14")
.Header=xlNo
.MatchCase=False
.Orientation=xlTopToBottom
.SortMethod=xlPinYin
.Apply
End With
Here is a sample of the recorded macro code. How could I specify to use the macro button at the bottom of Column E in this example?
Rows("4:14").Select
Active Sheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("E4:E14"), _
SortOn:=xlSortOnValues, Order:xlDescending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("A$:CV14")
.Header=xlNo
.MatchCase=False
.Orientation=xlTopToBottom
.SortMethod=xlPinYin
.Apply
End With