Please Help with Excel Sorting Macro!!

  • Thread starter Thread starter ticketopia
  • Start date Start date
T

ticketopia

Help!!! I need a macro that will sort data by a column when the user
clicks on the column heading (i.e., username).

The macro then needs to return the user to the cell that was selected
prior to sorting the data.

Oh yeah, and I need it within a 1/2 hour.......

Puhleeeeeeaase help me!!!!!

Thanks so much!!
 
Right click on the sheet tab>view code>insert this>save workbook.
name your range to be sorted as sortrange
Double click on any column to sort by that column.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel
As Boolean)
[sortrange].Sort Key1:=Cells(1, activecell.column), Order1:=xlAscending,
Orientation:=xlTopToBottom
SendKeys "^{home}"
End Sub
 
Back
Top