Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check if sheet is protected and cell is locked

Posted on 2012-04-12
2
Medium Priority
?
642 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
[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
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

610 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