K
Ken
Sorry about previous post, I did something spastic and posted
prematurely
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)
Range("DB_Cost_Report").Sort Key1:=Target.Offset(3, 0),
Order1:=True, Header:=xlfalse, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ord = Not (ord)
Cancel = True
End Sub
ord is a global variable stored in a regular code module; since it
seems that I can't store a global variable in a worksheet module.
Is it not possible to control the order with a boolean, or am I
missing something.
Thanks
Ken
prematurely
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)
Range("DB_Cost_Report").Sort Key1:=Target.Offset(3, 0),
Order1:=True, Header:=xlfalse, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ord = Not (ord)
Cancel = True
End Sub
ord is a global variable stored in a regular code module; since it
seems that I can't store a global variable in a worksheet module.
Is it not possible to control the order with a boolean, or am I
missing something.
Thanks
Ken