Protect Only an Object on a Worksheet

R

Reed Markley

Hi All:
In Excel XP (2002), how do I protect only a pushbutton object, so users
won't reformat or delete it. I want to leave the rest of the sheet
completely unprotected, since I am using a VBA form to modify and add data
to the worksheet. The button launches the form. I have set all the cells on
the sheet to be unlocked by selecting all the cells on the sheet and
unchecking the checkbox in the format cells dialog. I then go to
Tools-Protection-Protect Sheet and check all the checkboxes except the ones
to allow users to edit objects and scenarios and to select locked cells. I
check the Protect worksheet and contents of locked cells checkbox and hit
OK. Theoretically, only objects should be protected. There are no scenarios
or locked cells on the sheet. The object (button) is indeed protected. I
then push the button to launch the data entry form and get the following VBA
message. Run-time error '1004': Delete method of Range class failed. Te code
behind the form does indeed delete a cell at the start. The form does not
appear. If I select debug on the error message I am taken to the code
performing the delete operation.

What am I doing wrong. I had no trouble getting this technique to function
properly in Excel 2000.
 
D

davesexcel

I
then push the button to launch the data entry form and get the
following VBA
message. Run-time error '1004': Delete method of Range class failed. Te
code
behind the form does indeed delete a cell at the start. The form does
not
appear. If I select debug on the error message I am taken to the code
performing the delete operation.

When you message comes up, have you pressed help to see what was up?
Does the message come up only when there is nothing to delete?

Just wondering, need more info,
I have had macros that searched for a word and delete the row, if it
couldn't find the word I would get an error, so ended needing some
extra code like
on error exit 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