Answers for "protect a cell vba"

VBA
0

excel vba protect cells with formula

' Protects cells containing formulas, with password
' pPwd: password to protect / unprotect
Sub ProtectFormulas(ByRef pRange As Range, ByVal pPwd As String)
    ActiveSheet.Unprotect pPwd
    For Each r In pRange
        r.Locked = IIf(r.HasFormula, True, False)
    Next r
    ActiveSheet.Protect pPwd
End Sub

Sub TestIt()
    ProtectFormulas Range("A1:B4"), "MyPassWord"
End Sub
Posted by: Guest on January-17-2021
0

excel vba protect content

'Apply protection on worksheet content (cells with Protected = True)
Sheets("Sheet1").Protect Password:="myPassword", _
    DrawingObjects:=False, _
    Contents:=True, _
    Scenarios:=False
Posted by: Guest on March-26-2021

Code answers related to "protect a cell vba"

Code answers related to "VBA"

Browse Popular Code Answers by Language