Please help me code the proper method to using a Case Statement. Here's what I have coded:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'----------------------------------------------
' Test where the double click occurred
'----------------------------------------------
Select Case Target.Row And Target.Column
Case Target.Row = 2 And Target.Column = 1
SortProhibit = 2
Case Is = 4 And 1
SortProhibit = 1
End Select
End Sub
I have 60 test that I need to perform to dertime which cell the double click happened. Is there a better way of dong this test? I started using If/Then but thought the Case would be more efficent.
The problem with the above statements is that although the Target.Row is 4 and Target.Column is 1, It still falls into setting the SortProhibit variable to 2.
Thanks...
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'----------------------------------------------
' Test where the double click occurred
'----------------------------------------------
Select Case Target.Row And Target.Column
Case Target.Row = 2 And Target.Column = 1
SortProhibit = 2
Case Is = 4 And 1
SortProhibit = 1
End Select
End Sub
I have 60 test that I need to perform to dertime which cell the double click happened. Is there a better way of dong this test? I started using If/Then but thought the Case would be more efficent.
The problem with the above statements is that although the Target.Row is 4 and Target.Column is 1, It still falls into setting the SortProhibit variable to 2.
Thanks...