View Single Post
 
Old 07-29-2024, 05:13 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2021
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

This will work regardless of which sheet you're on as long as the workbook you want it to work in is the active workbook:
Code:
Sub ProtectFormulaCellsInTable_tAbstract()
With Range("tAbstract")
  .Parent.Unprotect
  .SpecialCells(xlCellTypeFormulas).Locked = True
  .Parent.Protect
End With
End Sub
Changing the message when someone tries to change a locked cell on a protected sheet is not possible (afaik) but something else can be done, see:
custom error message in popup window for protected cell? | MrExcel Message Board


…but is it worth it?
Reply With Quote