Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Can I set up a sort by clicking on table a heading
I have a table I would like to set up to be sorted by clicking on a table
heading. Is that possible in Excel? Thank you. |
#2
|
|||
|
|||
Can I set up a sort by clicking on table a heading
Hi Aaron
Dave Peters has written some nice code to do this. It is available for download at Debra Dalgleish's site http://www.contextures.com/xlSort02.html#Rectangles Regards Roger Govier Aaron wrote: I have a table I would like to set up to be sorted by clicking on a table heading. Is that possible in Excel? Thank you. |
#3
|
|||
|
|||
Can I set up a sort by clicking on table a heading
Perfect!!
Thank you. |
#4
|
|||
|
|||
Can I set up a sort by clicking on table a heading
Aaron
Yes. I take it that you want the sort key to be the column you clicked on. You would use the Worksheet_SelectionChange event macro. You would write code in that macro to check that the cell selected is one of the header cells. If it isn't, do nothing. If it is, sort the table with that column as the key column. An example macro follows. I assumed the table had the range name "TheTable" and that the range of the headers is A1:E1. Make the necessary changes. Post back if you need more. HTH Otto Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count 1 Then Exit Sub If IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1:E1")) Is Nothing Then Range("TheTable").Sort Key1:=Target.Offset(1), Order1:=xlAscending, Header:=xlYes, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub "Aaron" wrote in message ... I have a table I would like to set up to be sorted by clicking on a table heading. Is that possible in Excel? Thank you. |
#5
|
|||
|
|||
Can I set up a sort by clicking on table a heading
Well, thank Dave Peterson actually.
Apologies Dave for shortening your name in the previous post, Dave Peters was a guy I was at University with. Regards Roger Govier Aaron wrote: Perfect!! Thank you. |
#6
|
|||
|
|||
Can I set up a sort by clicking on table a heading
I'm sure he as a very nice person--even though he was missing that "ON"!
Roger Govier wrote: Well, thank Dave Peterson actually. Apologies Dave for shortening your name in the previous post, Dave Peters was a guy I was at University with. Regards Roger Govier Aaron wrote: Perfect!! Thank you. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select rows and sort based on type | Excel Discussion (Misc queries) | |||
How to get pivot table Time field to appear correctly | Excel Worksheet Functions | |||
Pivot Table Sorting | Excel Discussion (Misc queries) | |||
Removing errors from a Pivot table | Excel Discussion (Misc queries) | |||
table | Excel Worksheet Functions |