protection indicator

N

nader

Hi
I write two question a bout this but no answer
pleas, if possible I want a function that if worksheet protected write a
text in a cell
like "protected" if not protected, write "unprotected".
kind regards
nader
 
S

Satti Charvak

You can use the following sample macro code

Sub SetProtection()

Range("A1").Formula = "1"
Range("B1").Formula = "3"
Range("C1").Formula = "4"
ActiveSheet.Protect

' Check the protection setting of the worksheet and act accordingly.
If ActiveSheet.Protection.AllowInsertingColumns = False Then
ActiveSheet.Protect AllowInsertingColumns:=True
MsgBox "Insert a column between 1 and 3"
Else
MsgBox "Insert a column between 1 and 3"
End If

End Sub


You can use the following protection properties:
AllowDeletingColumns
AllowDeletingRows
AllowFiltering
AllowFormattingCells
AllowFormattingColumns
AllowFormattingRows
AllowInsertingColumns
AllowInsertingHyperlinks
AllowInsertingRows
AllowSorting
AllowUsingPivotTables
 

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

Top