I need to sort an active sheet using the col of the active cell

G

Guest

My intent is to create a Sort Button that will read the Active Column for
sorting the ActiveSheet.
 
O

Otto Moehrbach

One way:
Sub SortByActiveCellColumn()
Selection.Sort Key1:=Cells(2, ActiveCell.Column), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
I assumed your data has headers. Also, you have to select the entire range
you want sorted before you run this macro. Post back if you want help with
refining this to work with what you actually have. HTH Otto
 
G

Guest

Otto Moehrbach said:
One way:
Sub SortByActiveCellColumn()
Selection.Sort Key1:=Cells(2, ActiveCell.Column), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
I assumed your data has headers. Also, you have to select the entire range
you want sorted before you run this macro. Post back if you want help with
refining this to work with what you actually have. HTH Otto



Thanks Otto
That was just the clue I needed. All the other code is in place and working.
Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top