ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is this possible?? Please help (https://www.excelbanter.com/excel-discussion-misc-queries/144816-possible-please-help.html)

Kev

Is this possible?? Please help
 
I need to be able to click on my column titles to have the rows sorted by the
information in those colums.

Like in a windows file, Click on date created or auther etc.

So is it possible?? and does this have a name??

Please help i an sooo stuck.

Don Guillett

Is this possible?? Please help
 
Right click sheet tabview codeinsert thismodify to suit your range.
Now when you double click on any cell in the desired column the range will
be sorted by that column.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
ac = ActiveCell.Column
Range("A2:B6").Sort Key1:=Cells(3, ac), Order1:=xlAscending
End Sub

--
Don Guillett
SalesAid Software

"Kev" wrote in message
...
I need to be able to click on my column titles to have the rows sorted by
the
information in those colums.

Like in a windows file, Click on date created or auther etc.

So is it possible?? and does this have a name??

Please help i an sooo stuck.



vezerid

Is this possible?? Please help
 
On Jun 1, 3:53 pm, Kev wrote:
I need to be able to click on my column titles to have the rows sorted by the
information in those colums.

Like in a windows file, Click on date created or auther etc.

So is it possible?? and does this have a name??

Please help i an sooo stuck.


This VBA Event macro will do:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1:F1")) Is Nothing Then
Range("A1:F100").Sort Key1:=Target, Order1:=xlAscending, Header:=
_
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub

It assumes that your titles are in A1:F1 and the table will not be
longer than A1:F100. Change these to suit. Then:

Right click on the sheet tab. Choose View Code... This will take you
to the VBA IDE. Paste the above code in the window.

HTH
Kostis Vezerides


Roger Govier

Is this possible?? Please help
 
Hi

Dave Peterson has created a nice utility using shapes to ensure the
correct set of data is captured for the sort.
This can be downloaded from
http://www.contextures.com/xlSort02.html
--
Regards

Roger Govier


"Kev" wrote in message
...
I need to be able to click on my column titles to have the rows sorted
by the
information in those colums.

Like in a windows file, Click on date created or auther etc.

So is it possible?? and does this have a name??

Please help i an sooo stuck.





All times are GMT +1. The time now is 04:07 PM.

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