LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default boolean to control sort order

sortOrder = xlAscending
or
sortOrder = xlDescending

These parameter are really constant numbers store in Excel. You can assign
them to variables. I used blow in the sort SortOrder instead of xlAscending
or xlDescending



Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Range("DB_Cost_Report").Sort Key1:=Target.Offset(3, 0),
Order1:=sortOrder, Header:=xlfalse, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ord = Not (ord)
Cancel = True
End Sub



"Ken" wrote:

Okay, so I am a spastic idiot; the first time I posted prematurely,
the second time as soon as I sent it I realized my mistake. Since
False corresponds to zero, not 2, which is what I need for a decending
sort, of course it fails. True works fine because it corresponds to 1
which gives me the ascending sort. I guess a couple lines of code to
handle my 1 to 2 to 1 toggle won't be too bad.

Thanks

Ken

 
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 do I control the sort order of a filter in a pivot table? Grizz Excel Discussion (Misc queries) 1 December 20th 08 02:01 PM
boolean to control sort order Ken Excel Programming 0 October 31st 08 02:41 PM
Retaining Sort order in the Sort Dialog box CBittinger Excel Discussion (Misc queries) 2 January 9th 08 05:01 PM
Sort sheet based on particuilar sort order Also Excel Worksheet Functions 4 January 3rd 08 09:31 AM
Pls. reply Sort Data and copy to next coulmn when sort order chang shital shah Excel Programming 1 August 19th 05 02:51 PM


All times are GMT +1. The time now is 04:32 AM.

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

About Us

"It's about Microsoft Excel"