Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro that uses column headings as column sort 'buttons'

This can be done in a word table via a macro; can it be done in Excel?

Click on any column heading and entire spreadsheet is sorted on that column.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default macro that uses column headings as column sort 'buttons'

using this macro:

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)

End Sub

i think you could do what you want. you'd have to set the target
range as the header row, & you'd have to double-click, not single-
click. but i don't have any experience with it. search the newsgroup
for "workbook_sheetbeforedoubleclick" & i'll bet you'll get some
ideas.

since this macro is a workbook macro, you have to put it in the
"ThisWorkbook" object.
hope it gets you started!
:)
susan




On Jan 22, 2:33*pm, Rob Benz
wrote:
This can be done in a word table via a macro; can it be done in Excel?

Click on any column heading and entire spreadsheet is sorted on that column.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default macro that uses column headings as column sort 'buttons'

Use the BeforeDoubleClick Event on the worksheet

Within that event, use the Sort method with the "Target" variable in the
Key1 argument.

Be sure to have

Application.EnableEvents=False

At the beginning and the same line at the end, but only changed to "True".

Then all you would have to do is double click on the heading.

--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Rob Benz" wrote in message
...
This can be done in a word table via a macro; can it be done in Excel?

Click on any column heading and entire spreadsheet is sorted on that
column.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default macro that uses column headings as column sort 'buttons'

If this is to be done for only one worksheet, you can instead of using it
within "ThisWorkbook" module, you can use it in the particular's worksheet
module, so as it doesn't have to look up the worksheet name to be sure it's
doing the sort on the proper worksheet.

--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Susan" wrote in message
...
using this macro:

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)

End Sub

i think you could do what you want. you'd have to set the target
range as the header row, & you'd have to double-click, not single-
click. but i don't have any experience with it. search the newsgroup
for "workbook_sheetbeforedoubleclick" & i'll bet you'll get some
ideas.

since this macro is a workbook macro, you have to put it in the
"ThisWorkbook" object.
hope it gets you started!
:)
susan




On Jan 22, 2:33 pm, Rob Benz
wrote:
This can be done in a word table via a macro; can it be done in Excel?

Click on any column heading and entire spreadsheet is sorted on that
column.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default macro that uses column headings as column sort 'buttons'

I like this technique from Debra Dalgleish's site:
http://contextures.com/xlSort02.html#Rectangles
Sort With Invisible Rectangles

Rob Benz wrote:

This can be done in a word table via a macro; can it be done in Excel?

Click on any column heading and entire spreadsheet is sorted on that column.


--

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
How can I keep 2 rows of column headings out of sort data? dk Excel Discussion (Misc queries) 1 May 4th 09 05:15 PM
How to sort without including column headings in sort OPDvolunteer Excel Discussion (Misc queries) 4 March 11th 09 04:08 PM
Worksheet has numeric column headings. Change to alpha headings? Be Frank Excel Discussion (Misc queries) 1 June 18th 08 04:22 PM
Macro To Change Column Headings Bob Excel Programming 2 March 27th 08 04:43 PM
can I sort using column headings, in a macro, not "a1" John Excel Programming 4 October 23rd 04 05:02 PM


All times are GMT +1. The time now is 01:27 AM.

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"