Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Conditional Cell Protection

Posted on 2010-08-23
7
Medium Priority
?
652 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

704 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