My excel on default have all columns locked when I select protect sheet.
I’d like to use a VBA code where I only lock cells with formulas (and only allow users to select unlocked cells) while looping through every worksheet that I have in the workbook. This is the code that I currently have.
Sub LockSheets()
Dim ws As Worksheet
For Each ws In Worksheets
With ws
.Unprotect
.Cells.Locked = False
.Cells.SpecialCells(xlCellTypeFormulas).Locked = True
.Protect
End With
Next ws
End Sub