protected sheet

G

Guest

I protected sheet in macro with the following code but not all the column was
protected?

Worksheets("GiveGetDB").Protect Contents:=True

Any one can help?

Thanks,
shlomit
 
D

Dave Peterson

If some of the cells in those columns are unlocked (format|Protection tab), then
those cells can still be changed.
 
N

Nick Hodge

Shlomit

Are the cells unlocked? Protection will only work if the cells are also
locked

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 
G

Guest

So how can I lock all the cells and protected the sheet in the macro?

Thanks,
Shlomit
 
G

Gord Dibben

To lock all the cells and protect the sheet........

Sub SHEETPROTECT()
With ActiveSheet
.Cells.Locked = True
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End With
End Sub


Gord Dibben MS Excel MVP
 

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