how to protect a sheet

Y

youngman

hi,
i d like to protect my sheets.
i know there are many methods to do it,but i just want to do by setting

the property of the sheet to be -4142-xlnoselection.

but it comes to be of no result.

what is the problem.

thank you.
 
T

Tom Ogilvy

Activesheet.Protect Password:="ABCD:
ActiveSheet.EnableSelection = xlNoSelection

The EnableSelection property has to be set each time the workbook is opened
as it does not persist across the closing and opening of a workbook. You
might set it in the workbook_Open event or worksheet_Activate event or both.
 
Y

youngman

thanks for your answer.
1."The EnableSelection property has to be set each time the workbook is
opened as it does not persist across the closing and opening of a workbook".
but why. is it a problem,or it is set to be so.
2.i don't want to protect my sheet with a macro,for it can be disable easily
when the file is opened.

thank you.
 
T

Tom Ogilvy

1. That is the way it works

2. Protection itself is persistent. If all cells are locked and you
protect the sheet, the user will not be able to enter any changes. It is
the enableselection property that is not persistent.

If you don't want to use it, that is certainly your choice.
 
Y

youngman

thank you very much.
1. That is the way it works.
is there any merit in this point. in ordinary feeling,whenever we save a
file ,we can restore all property we want to have.
2. Protection itself is persistent. If all cells are locked and you
protect the sheet, the user will not be able to enter any changes. It is
the enableselection property that is not persistent.

once you run the macro you do protect the sheet,but when someone reads the
file in,it is simple to disable the macro.
anything wrong with my thinking.
regards

---------------------------------
 

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