View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Automatically lock cells and hide formulas

for each c in selection
if c.hasformula then
next c

--
Don Guillett
SalesAid Software

"Qaspec" wrote in message
...
Thanks....my only problem is that this locks all cells. I would like to

only
lock cells that contain formulas. If possible.

"Nick Hodge" wrote:

Something like the code below in the Workbook_open() event will do

Private Sub Workbook_Open()
Dim wks As Worksheet
For Each wks In Me.Worksheets
With wks
.Cells.Locked = True
.Cells.FormulaHidden = True
.Protect Password:="abcd"
End With
Next wks
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Qaspec" wrote in message
...
I'd like to set the cell format properties to "lock" and "hide" any
formulas
entered into the cells and protect each sheet when my workbook is

opened.