View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
JB JB is offline
external usenet poster
 
Posts: 115
Default Sort table with one click on header?

Sort on Double-Clic:

http://boisgontierj.free.fr/fichiers...licColonne.xls

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Set titre = Target.CurrentRegion.Resize(1,
Target.CurrentRegion.Columns.Count)
If Not Intersect(titre, Target) Is Nothing Then
OrdreTri = IIf(Target.Interior.ColorIndex = 3, xlDescending,
xlAscending)
Target.CurrentRegion.Sort Key1:=Cells(1, Target.Column),
Order1:=OrdreTri, Header:=xlGuess
m = IIf(Target.Interior.ColorIndex = 3, 4, 3)
titre.Interior.ColorIndex = 44
Target.Interior.ColorIndex = m
End If
Cancel = True
End Sub

JB
On 4 mar, 00:31, Colby wrote:
I want to sort a table in Excel 2003 by clicking on any of the column headers
-- like in an email window. The "Create List" feature is almost what I need,
but I want to show only "Sort Ascending" and "Sort Descending" on the
pull-downs. [It's unfortunate that you have to scroll *up* to see the Sort
options in those pull-downs.]

Is there a way to eliminate or mask the other filtering options that appear
in the List pull-downs? Or is there another way I can sort by column headers
with one click?

Thanks for any ideas on this.