Target of a double click event can be wrong when on a protected sheet. Looking for workaround

UWMmakow

New Member
Joined
Feb 25, 2014
Messages
30
I Googled for a while and couldn't find this issue.

I have a protected sheet with a BeforeDoubleClick event as follows:

Code:
If Not Intersect(Target, Range("M1")) Is Nothing Then
     frmMain.Show
End If

M1 is unlocked, along with about a dozen other cells. The ~dozen cells are for user entry, and M1 brings up a form with access to some tools when double clicked. All other cells are locked and not selectable.

If M1 is selected, and the user double clicks over any of the locked cells, the form opens. This must be because M1 is the target, being that it is still the currently selected cell. Even though the double click didn't actually occur on M1.

Of course I want to avoid this. Can anyone think of a work around? Thanks.
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi.
Try allowing access to locked cells as you protect the sheet.

Also, put a Cancel=True command:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
 Cancel = True
...
...
 
Last edited:
Upvote 0
Wow, for some reason I thought if you let users access the locked cells, they could also edit them. But I never tested it! Thanks for the heads up.

What does Cancel = True do?
 
Upvote 0
Cancel=True gets rid of the Edit Mode of the cell that was double clicked and, in this case, it prevents the alert message after DoubleClick on a locked cell.
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top