Suppress Protection Prompt

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
950
Office Version
  1. 2019
Platform
  1. Windows
Is there a macro to supress the popup prompt saying "the cell is protected...." when users double click on a protected cell ?

i prefer for nothing to happen when users double click a protected cell..
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
If you just want to get rid of the prompt when doubleclicking then i guess you can use this in the worksheet module:

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
End Sub

Regards.
 
Upvote 0
that's true .. but will this code work when users want to double click to edit cells which are not protected ??
 
Upvote 0
could you not amend the code to say:

If cell is a formula then "Cancel = TRUE" otherwise edit cell when users double click on a cell

?
 
Upvote 0
You can forbid selection in locked cells all together.

<table width="100%" border="1" bgcolor="White" style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New>  <font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> Worksheet_Activate()
       Me.EnableSelection = xlUnlockedCells
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table><button onclick='document.all("102620079273906").value=document.all("102620079273906").value.replace(/<br \/>\s\s/g,"");document.all("102620079273906").value=document.all("102620079273906").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("102620079273906").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="102620079273906" wrap="virtual">
Private Sub Worksheet_Activate()
Me.EnableSelection = xlUnlockedCells
End Sub</textarea>
 
Upvote 0
Hi

I may have got the wrong end of the stick here but can you not just uncheck 'Select Locked Cells' when protecting the sheet, this will mean that the cell cannot be selected thus bypassing the unwanted error message.

HTH

Dave
 
Upvote 0
No Dave. You have the right end of the correct stick. We simply take pleasure in over-complicating things. :)
 
Upvote 0
however, the bad thing about

Private Sub Worksheet_Activate()
Me.EnableSelection = xlUnlockedCells
End Sub

is that you cannot select and copy locked cells..

can we not have a macro along the lines:

before double click

if selected cell is a formula then "cancel = True"

otherwise

do nothing (i.e. when you double click you are able to edit the cell)

??
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,451
Members
449,161
Latest member
NHOJ

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