Runtime error #1004

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have developed a workbook which contains multiple worksheets. Within each
worksheet I have added security with the exception to certain cells. To do
this I selected the cells and within security I unchecked the "locked" box; I
then protected the sheet.
On one page I have a command button that is coded to clear all of those
unlocked cells. An example of the code would be as follows:
Worksheets("Book").Range("C4:C10,C12:C13,C16").ClearContents
Each individual sheet contains this same range code within a command button.
My Problem is that the command button on my Table of Contents page with the
above code gives me a runtime error #1004.
Can someone help me keep the security in place but allow this button to run...
Thank you so much for your help in Advance...
Ed Prill
 
hi,
try this
Range"C4:C10,C12:C13,C16").ClearContents
and run the macro from the macro window not the button
other wise you will have to write a clear contents for
each sheet like this
workbooks("book").sheets("sheet1").range....clearcontents.

Regards
Frank
 
Frank,
I really appreciate your help on this. However I think I may have worded
this in-correctly.
I have coded each individual sheet and those buttons work flawlessly. The
problem I am having is the button that is on a different sheet referencing
that sheet. From your response i think I may have lead on that i could not
get them to clear at all. That is not the case. I just need to be able to
keep the security but be able to clear cells on different sheets from 1
location.
I hope this makes sense.
Thank You again for your help
Ed
 
Back
Top