Protectected cell ignore

A

Anthony Byrne

How do I prevent the warning message appearing when trying to alter a protected cell.
 
D

Dave Peterson

You could have a macro that does the protecting--put it in your auto_open
or workbook_open event:

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi"
.EnableSelection = xlUnlockedCells
End With
End Sub


Excel won't remember this setting after you close it and reopen the workbook
(that's why it's in auto_open).
 
A

Anthony Byrne

Thank you Dave but all I really want to do is stop the warning message. I do not want to alter the protected cell.
 
A

Anthony Byrne

Thank you, but all I want is to prevent the message. I do not really want to gain access to the cell.
 
A

Anthony Byrne

Thank you. All I really want is for the warning message to be cancelled. In other words if someone wants to change a protected cell, nothing happens

I do not want to change the contents of a protected cell.
 
D

Dave Peterson

You can't intercept this message, but you can stop the user from selecting a
cell that could cause the message to pop up (if they tried to change it).

This line:
..EnableSelection = xlUnlockedCells
limits the cells the users can click on. Hence, the warning message won't
appear.

(This won't allow a user to change a locked cell on a protected worksheet.)

==
But as an aside, worksheet protection inside excel is very weak.

From J.E. McGimpsey's site:
http://www.mcgimpsey.com/excel/removepwords.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top