Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel Conditional Cell Protection

Posted on 2010-08-23
7
Medium Priority
?
655 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:Tracy
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:
Tracy earned 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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:Tracy
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:Tracy
ID: 33521099
Yes, that's correct.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Quickbooks hosting can do wonders to your enterprise but considering the points elaborated in the article which will help you to better analyze the outcomes. So scan your business, its needs and then move to the new world of limitless benefits.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

879 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