View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_77_] Steve[_77_] is offline
external usenet poster
 
Posts: 17
Default Protect formulas but still allow formatting, etc.?

I'm trying to protect all the cells in a spreadsheet with formulas in
them (don't mind the user seeing the formulas, just don't want him
changing them), have done so using the following code (compliments of
this group, thanks!):

Sub lock_cells()
Set mySheets = ActiveWorkbook.Sheets
For Each s In mySheets
If s.Name < "Information Summary" Then
s.Activate
ActiveSheet.Unprotect
Cells.Locked = False
Selection.SpecialCells(xlCellTypeFormulas, 23).Locked =True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End If
Next s
End Sub

Problem is, some functionality goes away -- e.g., I have some sheets
where I have grouped rows/columns, and once the sheet is protected the
user cannot collapse/expand these groups. Also, on a protected sheet
the user cannot change any formatting -- can't bold or indent, change
column width or font color/size, etc.

Is there a way to simply lock only the cells with formulas but still
allow the user to do anything else on the sheet(s)? Something like
lock the cells without protecting the sheet?