Vba Protect Sheet Range. For this, we have a built-in vba method called "Protect". VBA-Excel: Change Font, Color, Weight of Table Data in the Word.
Save End Sub Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim cCol cCol = ActiveCell. Remember to save your file in either XLSM or XLAM format to save your VBA code. Restrict users to edit the cell; Lock Cell and Unlock Cell.
When you protect a worksheet, you are preventing the user from changing values in cells and making other changes to the worksheet.
This property returns True if the object is locked, False if the object can be modified when the sheet is protected, or Null if the specified range.
Today let's look at how to write an Excel VBA Macro to quickly protect any cell in your worksheet which contains a formula. In the Refers to cells box, type an equal sign ( = ), and then type the reference of the range that you want to unlock. Right click on a Cell > Format Cells > Protection > check Locked.