Automatically lock cells and hide formulas

G

Guest

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.
 
N

Nick Hodge

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
(e-mail address removed)
 
D

Don Guillett

Look in help index for protection and then
Password protect a worksheet or workbook
 
G

Guest

Thanks....my only problem is that this locks all cells. I would like to only
lock cells that contain formulas. If possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top