数式が入力されているセルだけを保護する

 

Sub test()

’ 数式が入力されているセルだけを保護する

    
    With Selection
            .Locked = False
             .SpecialCells(xlCellTypeFormulas, 23).Select
             .Locked = True
    End With
    ActiveSheet.Protect

 

End Sub

 

実行結果

 

 

― ― ― ― ― ― ― ― ― ― → Excel VBA基礎入門もくじ へ戻る 

 

参考記事