Solved

Excel Conditional Cell Protection

Posted on 2010-08-23
7
641 Views
Last Modified: 2012-06-27
I have a spreadsheet with rows which users need to edit before final approval but not afterward.  I need some help with conditional protection.  Basically, in the attached spreadsheet, if L5 is <> null, I need entire row 5 protected.  If L5 = null, then the row should be open for editing.  And then this same criteria applied to the remainder of the spreadsheet, with the L column from cell 5 onward as the key.  Can anyone help?
PropertyPass.xls
0
Comment
Question by:mrherndon
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:broomee9
ID: 33505209
Your sheet is password protected.  Unprotect and re-post.
0
 

Author Comment

by:mrherndon
ID: 33505277
Apologies.  Unprotected.
PropertyPass.xls
0
 
LVL 24

Accepted Solution

by:
broomee9 earned 500 total points
ID: 33505360
OK, try this:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler

    Application.EnableEvents = False

    If Target.Column = 12 And Target.Count = 1 Then
        Call UnProtect
        If Target.Value <> "" Then Rows(Target.Row).Locked = True
        Call Protect
    Else
    End If

finished:
    Application.EnableEvents = True
    Exit Sub

errHandler:
    MsgBox Err.Number & " - " & Err.Description
    Resume finished

End Sub

Open in new window

PropertyPass-2-.xls
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:mrherndon
ID: 33505583
Thanks.  It works great on the "test" line.  But the rest of the sheet is unaffected.  What am I missing?
0
 
LVL 24

Expert Comment

by:broomee9
ID: 33506400
The values are already filled in.  This code is triggered when you enter a new value in column L.  So either protect the cells now for each line that already has a value, or remove the initials and then re-add them back in and the code will execute for each one.
0
 

Author Comment

by:mrherndon
ID: 33506605
I see.  So, going forward it will lock new data.  Existing data I can manually lock.  Do I understand you correctly?
0
 
LVL 24

Expert Comment

by:broomee9
ID: 33521099
Yes, that's correct.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
My experience with Windows 10 over a one year period and suggestions for smooth operation
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question