Solved

Check if sheet is protected and cell is locked

Posted on 2012-04-12
2
583 Views
Last Modified: 2012-06-21
Hi,

I know you can directly lock a cell/protect a sheet.

But is there anyway to check if a sheet is protected via VBA? if then (yes) a specific cell is locked?

Searches returned nothing relevant. Any help is appreciated!

Thanks!
0
Comment
Question by:Shanan212
2 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 37839939
Yes.  Something like this:

With ActiveSheet
    If .ProtectionMode Then
        If .[a1].Locked Then 
            MsgBox "Cell locked"
        Else
            MsgBox "Cell unlocked"
        End If
    Else
        MsgBox "Worksheet unprotected"
    End If
End With

Open in new window

0
 
LVL 13

Author Closing Comment

by:Shanan212
ID: 37840012
Perfect! Thanks!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now