Check if sheet is protected and cell is locked

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!
LVL 13
Shanan212Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Patrick MatthewsConnect With a Mentor Commented:
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
 
Shanan212Author Commented:
Perfect! Thanks!
0
All Courses

From novice to tech pro — start learning today.