Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default boolean to control sort order

I am trying to use a boolean variable to control a sort Order. This
is a sort that is triggered by the double click event and I want to
toggle between Ascending and Decending in successive sorts. I can get
it to work when my variable a string that is toggled between
xlAscending and xlDecending, I can get it to work when the variable is
and integer toggled between 1 and 2, and I can get it to work when my
variable is Boolean equal to True. False causes and error. I would
like to simplify my already pretty simple code to

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Application.And(ActiveCell.row < 5, ActiveCell.row 1,
ActiveCell.Column 1, ActiveCell.Column < 180) Then
ord = True

' If Worksheets("Setup").Range("Sort_Order").Value =
"xlAscending" Then
' Ord = True
' Worksheets("Setup").Range("Sort_Order").Value = False
' Else
' Ord = False
' Worksheets("Setup").Range("Sort_Order").Value =
"xlAscending"
' End If

Range("DB_Cost_Report").Sort Key1:=Target.Offset(3, 0),
Order1:=2, Header:=xlfalse, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

ord = Not (ord)

Cancel = True

On Error GoTo 0

End If

If Application.And(ActiveCell.Column =
Range("Item_Number").Column, ActiveCell.row 4) Then
Sequences.Show
Cancel = True
End If

If ActiveCell.Column = Range("Item_Number").Column + 1 Then
On Error Resume Next
Call Hide_Columns(ActiveCell.Text)
Cancel = True
On Error GoTo 0
End If
End Sub
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 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
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
Control Order of Calculations BryanDamon Excel Discussion (Misc queries) 4 August 9th 07 07:36 PM
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 05: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"