![]() |
Double click a range
Is there a quick way to detect if the user double
clicks a specified range? I'm currently dealing with the "Target" parameter of the Worksheet_BeforeDoubleClick() function. I'm also testing all the Target.Row and Target.Col combinations to test for a specified range. Is this the only way to do this?? Thanks. |
Double click a range
Hi Robert
You can use named ranges and Intersect for this. Name a range of cells ClubbingArea and try this: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim R As Range On Error Resume Next Set R = Intersect(Target(1), Range("ClubbingArea")) If R Is Nothing Then Cancel = True MsgBox "Out" Else Cancel = True MsgBox ("in") End If End Sub HTH. Best wishes Harald "Robert Crandal" skrev i melding ... Is there a quick way to detect if the user double clicks a specified range? I'm currently dealing with the "Target" parameter of the Worksheet_BeforeDoubleClick() function. I'm also testing all the Target.Row and Target.Col combinations to test for a specified range. Is this the only way to do this?? Thanks. |
Double click a range
Robert Crandal wrote:
Is there a quick way to detect if the user double clicks a specified range? I'm currently dealing with the "Target" parameter of the Worksheet_BeforeDoubleClick() function. I'm also testing all the Target.Row and Target.Col combinations to test for a specified range. Is this the only way to do this?? Thanks. that is the only way if not intersect (target, <range you are interested in) is nothing then .... your code here ..... end if just be careful with one thing target can overlap with <your range but does not have to be fully included in it. just decide if in your code you want to play with target or with intersect (target, <your range) |
Double click a range
Something like this, perhaps...
If Target.Address < Range("MySpecificRange").Address Then Exit Sub OR If Intersect(Target, Range("MySpecificRange")) Is Nothing Then Exit Sub -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
All times are GMT +1. The time now is 05:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com