cells protection

T

tofimoon3

Dear sir, with my regards, i have a workbook with about ( 10 sheets
full of formulas,to send these formulas away from spongers , i protcte
some cells or columns which contain them, when i want to work on an
sheet i cancell the protection and forget to protect again .
Is there any way in excell 2003 to protect these cells directly when
close the sheets.
Thanks in advance
 
C

CurlyDave

Sure with VBA.
Place this code in a workbook module, if you don't know where that is,
check out this site
http://www.contextures.com/xlvba01.html#Workbook

Place this code there

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim Shts As Worksheet

For Each Shts In ThisWorkbook.Worksheets
Shts.Protect Password:="123"
Next
end sub
 
M

muddan madhu

press alt + f11 , click this workbook ( left hand side )

Insert this code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For a = 1 To Sheets.Count
Worksheets(a).Protect
Next
End Sub
 

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