Solved

Check if sheet is protected and cell is locked

Posted on 2012-04-12
2
592 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

930 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

12 Experts available now in Live!

Get 1:1 Help Now