ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   beforeDoubleClick (target, true) (https://www.excelbanter.com/excel-programming/297867-beforedoubleclick-target-true.html)

Mark Kubicki

beforeDoubleClick (target, true)
 
in a beforeDoubleClick procedure, i set the cancel arguement to true which
solves some wierd select/reselect problems that i was having;

however, when the user selects another cell, i want them to be able to use a
double click to initiate in-cell editing; however the beforeDoubleClick
procedure disabled it...

how (when the user selects a different cell that the double click target) do
i get it back on?



Chip Pearson

beforeDoubleClick (target, true)
 
Mark,

You have to test the Target variable to determine if it is in the
range for which you want to disable double-click. For example,
the following code will disable double-click function in the
range A1:B10, and leave it to normal behavior in all other cells.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Not Application.Intersect(Target, Range("A1:B10")) Is Nothing
Then
Cancel = True
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"mark kubicki" wrote in message
...
in a beforeDoubleClick procedure, i set the cancel arguement to

true which
solves some wierd select/reselect problems that i was having;

however, when the user selects another cell, i want them to be

able to use a
double click to initiate in-cell editing; however the

beforeDoubleClick
procedure disabled it...

how (when the user selects a different cell that the double

click target) do
i get it back on?





Mark Kubicki

beforeDoubleClick (target, true)
 
if the target cell is later selected by click (not a doubleclick), will the
user then be able to double click within the active cell to edit the
contents (i would want them to be able to)?


"Chip Pearson" wrote in message
...
Mark,

You have to test the Target variable to determine if it is in the
range for which you want to disable double-click. For example,
the following code will disable double-click function in the
range A1:B10, and leave it to normal behavior in all other cells.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Not Application.Intersect(Target, Range("A1:B10")) Is Nothing
Then
Cancel = True
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"mark kubicki" wrote in message
...
in a beforeDoubleClick procedure, i set the cancel arguement to

true which
solves some wierd select/reselect problems that i was having;

however, when the user selects another cell, i want them to be

able to use a
double click to initiate in-cell editing; however the

beforeDoubleClick
procedure disabled it...

how (when the user selects a different cell that the double

click target) do
i get it back on?








All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com