How to protect desired area of workbook and protect code.

A

avveerkar

I have created a small game with a worksheet displaying different colors
etc. in different cells and a few buttons on the sheet. Buttons have
their codes associated with them in the modules. Player has to choose
some cells, enter some data only in some particular cells marked for
the purpose and then click a button. This is very simple. I want
someone to tell me how I can save this workbook with all its associated
macros etc so that I can give a copy to anyone who can play the game but
cannot access the code, cannot change the format of the main sheet or
cannot change/edit any cell he is not required to and enter only those
cells to which access is required. I know this must be very elementary
but I am not able to achieve this. I work with XP and EXCEL2000. I have
seen simple quizzes in EXCEL where we have to give correct answers in a
particular column and it gives you score for correct answer. Except the
particular column the whole sheet is protected. You cannot edit any
other cell nor you can access the codes.

A V Veerkar
 
D

Dave Peterson

You can protect the project within the VBE.
Tools|VBAProject Properties|Protection tab
give it a memorable password.

You can protect worksheets within excel.
tools|protection|protect sheet

Be aware that this kind of protection is easily broken--but it's the best you
can do if you stay within excel.
 
A

avveerkar

Dave said:
You can protect the project within the VBE.
Tools|VBAProject Properties|Protection tab
give it a memorable password.

You can protect worksheets within excel.
tools|protection|protect sheet

Be aware that this kind of protection is easily broken--but it's th
best you
can do if you stay within excel.

Dave Peterson

Thanks Dave but this doesn't help. If I protect the sheet I canno
modify any cell manually or by macros which my game needs to do. If
"unlock" the cells ( which I want to write through macros or manuall
as required by the game ) before I protect the sheet, I am only allowe
to change the contents of the "unlocked" cells but not formatting etc.
need full access to change contents, formatting. In brief, all the cell
on the sheet which are not required to be changed while playing the gam
should be fully locked but all the cells which get modified by macros o
by the player should be fully accessible for changing values as well a
formatting.

Thanks
A V Veerka
 
D

Dave Peterson

xl2002 offered a lot more options when the worksheet is protected--you can allow
formatting changes, insertion/deletion of rows/columns. xl2002+ gives you much
more control.

If you're using xl2k or below, the most common suggestion would be to give the
users a set of macros that allow them to do only what you want. Your macros can
unprotect the sheet, do the work, and reprotect the sheet.
 
A

avveerkar

Dave said:
xl2002 offered a lot more options when the worksheet is protected--you
can allow
formatting changes, insertion/deletion of rows/columns. xl2002+ gives
you much
more control.

If you're using xl2k or below, the most common suggestion would be to
give the
users a set of macros that allow them to do only what you want. Your
macros can
unprotect the sheet, do the work, and reprotect the sheet.


Thanks. That is a good suggestion. Control access through Macros.
Protect and unprotect whenever you want it. I will work along those
lines.

A V Veerkar
 
Top