Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Aaron
 
Posts: n/a
Default 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   Report Post  
Roger Govier
 
Posts: n/a
Default 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   Report Post  
Aaron
 
Posts: n/a
Default Can I set up a sort by clicking on table a heading

Perfect!!

Thank you.

  #4   Report Post  
Otto Moehrbach
 
Posts: n/a
Default 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   Report Post  
Roger Govier
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select rows and sort based on type Sarah Excel Discussion (Misc queries) 0 October 11th 05 05:06 PM
How to get pivot table Time field to appear correctly wccmgr Excel Worksheet Functions 1 August 23rd 05 12:26 AM
Pivot Table Sorting jesterhs Excel Discussion (Misc queries) 0 August 4th 05 06:38 PM
Removing errors from a Pivot table Mighty Magpie Excel Discussion (Misc queries) 2 February 3rd 05 03:15 PM
table dow Excel Worksheet Functions 0 January 11th 05 05:17 PM


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"