How To Find If The ActiveCell Is Protected

  • Thread starter Thread starter FARAZ QURESHI
  • Start date Start date
F

FARAZ QURESHI

What would be the appropriate code for finding whether the active cell is
locked and protected?

Run-time error '438':
Object doesn't support this property or method

is being returned on the following piece:

If ActiveCell.Protected = True Then
MsgBox ("You can't change the contents of this Cell. It is locked &
protected.")

Help from you experts is sought!

Thanx in advance.
 
Try
If ActiveCell.Locked = True Then
MsgBox ("You can't change the contents of this Cell. It is locked &
protected.")
End If
 
Already tried! But Protection and locking is different. All the cells are
locked by default and the code won't proceed whether the sheet/cell is
protected or not.
 
Protection and locking is different. All the cells are locked by default and
the code won't proceed whether the sheet/cell is protected or not.
 
Found It!

Correct code would be:
If ActiveSheet.ProtectContents = True And ActiveCell.Locked = True Then
MsgBox ("Cell Is Locked & Worksheet Is Protected.")
End If
 
Found It!

Correct code would be:
If ActiveSheet.ProtectContents = True And ActiveCell.Locked = True Then
MsgBox ("Cell Is Locked & Worksheet Is Protected.")
End If
 
Thanks...

FARAZ QURESHI said:
Found It!

Correct code would be:
If ActiveSheet.ProtectContents = True And ActiveCell.Locked = True Then
MsgBox ("Cell Is Locked & Worksheet Is Protected.")
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top