View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default How do I: vba to create column sorting buttons/hyperlink

using the sheet's on double click event makes this trivial:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'sorts by the selected column, assumes row 1 is a header row
If Target.Row = 1 Then
Target.CurrentRegion.Sort Target, xlAscending, header:=xlYes
End If

End Sub

"Ronio" wrote in message
...
I would like to create a VBA that will take my column headings and create
either a hyperlink or a button for each column heading.
When the link/button is clicked it will sort the table by that column.

Thx,
Ronio