Excel Vba Protect Cells With Formula

[Solved] Excel Vba Protect Cells With Formula | Vb - Code Explorer | yomemimo.com
Question : excel vba protect cells with formula

Answered by : vastemonde

' 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

Source : | Last Update : Sun, 24 Jan 21

Answers related to excel vba protect cells with formula

Code Explorer Popular Question For Vb