与 if Worksheets("test").ProtectContents
我可以识别工作表是否受到保护。它只返回一个真实的,对吧?
如何检查它是否不 protected ?
If Worksheets("test").ProtectContents = True Then: Exit Sub:
For Each cell In Range("B6:B112")
...
Next cell
Else:
If Not Worksheets("test").ProtectContents Then
Dim rng As Range
...
当工作表受到保护时,必须执行 foreach 循环。如果不是工作表.. 中的部分是用于工作表未 protected 部分。
谢谢。
最佳答案
我想这就是你要找的,
If ActiveSheet.ProtectContents = True Then
MsgBox "Protected"
Else
MsgBox "Not protected"
End If
如果没有,请发表评论。希望我们能够解决您的问题。
关于vba - Excel - VBA 检查工作表是否不 protected ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45545776/