Creating conditional format to protect cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am wanting to create a conditional format or a data validation to protect a
cell if anything other than "New" exists in the cell, so that unless someone
has the password to unprotect the sheet they cannot change the cell value
unless "New" already exists. I cannot figure out how to do this. If you can
help me, please post a reply. Thank you.
 
one way.


Sub lockselect()


Sheets(1).Select
Sheets(1).Unprotect ("mypass")
Range("C1:C15").Select
Cells.Locked = True
For Each Cell In Selection
If Cell.Value = "new" Then Cell.Locked = False
Next Cell

Sheets(1).Protect ("mypass")
End Sub

You can use this macro each time the file is opened.
To make it work as a trial you have to protect the sheet first with mypass
as the password.
Range C1 to C15 need to be adjusted to suit.

Regards
 
Back
Top