Worksheet Protection

J

janmike

Hi Folks,

I built a spreadsheet for my brother, e-mailed it to him and 2 of th
worksheets in the workbook do not have the protection I put on them.
When I attempt to enter data on one of the protected sheets, I canno
enter data whereas my brother can. I am using Excel 2002 and believ
my brother is using 2000 or 2002.

Also, I have one worksheet (same workbook as before) that has levels o
row and column grouping. Is there a way to have grouping on
worksheet and then protect part of the worksheet and still have the +
(grouping) option work.

Thanks for the assistance and Happy New Year to all
 
D

Dave Peterson

First, I don't have a guess about why a worksheet would become unprotected.
(Well, I do have a guess (user error???)--maybe you protected the worksheet, but
either didn't save it protected or sent the wrong workbook?????).

But for the second part:

If you already have the outline applied, you can protect the worksheet in code
(auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

(you could use the workbook_open even under ThisWorkbook, too.)

Don't forget to lock the VBA Project, too. Else you'll have inquisitive types
looking at your code and seeing the password.

Inside the VBE, you can lock the project.
Tools|VBAProject Properties|Protection tab.
Give it a memorable password and lock the project for viewing.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
J

janmike

Thanks for the second part Dave, works great.

I have tested the worksheet, it is protected, it is saved and there i
only one name racking.xls. I have e-mailed the file to my wor
computer and all is well. The protection is absent from the compute
by brother has at home.????????????????
 

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