ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto data sort by clicking on column (https://www.excelbanter.com/excel-discussion-misc-queries/156205-auto-data-sort-clicking-column.html)

Jack C

Auto data sort by clicking on column
 
Apparently I can set up a spreadsheet to sort data by placing hot key in the
column indicator cell. (Similar to the newest on top in outlook)
How do I do this??

Dave Peterson

Auto data sort by clicking on column
 
In xl2003, you can apply data|filter|autofilter to the range and use the
dropdown arrow to sort your data.

Debra Dalgleish has a technique at her site that adds invisible rectangles in
the headers and then sorts the data by that field when you click on one of those
rectangles.

http://contextures.com/xlSort02.html

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Jack C wrote:

Apparently I can set up a spreadsheet to sort data by placing hot key in the
column indicator cell. (Similar to the newest on top in outlook)
How do I do this??


--

Dave Peterson

Jim May

Auto data sort by clicking on column
 
Here's a small example where I have a table (with 1 row headers) over
Range A1:F7 << Post below code into the Sheet Module Code window.

Simply Right-Click on any Column Header Row (Row 1 in this case)
HTH

Jim May

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Not Intersect(Target, Range("A1:F1")) Is Nothing Then
SortCol = ActiveCell.Column
With ActiveSheet.Range("A1").CurrentRegion
.Sort Key1:=Target.Value, Order1:=xlAscending, Header:=xlGuess,
OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End With
End If
End Sub

"Jack C" wrote:

Apparently I can set up a spreadsheet to sort data by placing hot key in the
column indicator cell. (Similar to the newest on top in outlook)
How do I do this??



All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com