ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creating conditional format to protect cells (https://www.excelbanter.com/excel-discussion-misc-queries/157584-creating-conditional-format-protect-cells.html)

2442

Creating conditional format to protect cells
 
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.

Bill Kuunders

Creating conditional format to protect cells
 
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

--
Greetings from New Zealand

"2442" wrote in message
...
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.





All times are GMT +1. The time now is 09:50 PM.

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