View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default delete all but protected cells

Kingtriton,
Is there no way to clear all of
the unprotected cells at once.
I dont understand, if the cells are unlocked and the sheet is protected,
you can still manipulate the unlocked cells, only the locked cells are
protected when the sheet is protected.

Yes, you can manipulate the unlocked cells but you can't change the
properties of those cells.
Example:
Take a sheet and unlock one cell.
Protect the sheet and then select "Format"
Note that the "Cells" option is grayed out.
The "Format" option is worksheet dependent.
Excel hasn't evaluated what cell you're in at this point.
It only knows that the sheet is protected and you can't choose
that particular option.

Is there no way to clear all of
the unprotected cells at once.

Gord's code will do this with my suggestions to either protect
the sheet via code (with the UserInterface option) or Unprotect
the sheet before you run Gord's code (and reprotect afterwards).

I want to avoid this because it makes the sheet move around
when you run the sub

Application.ScreenUpdating = False
at the beginning of your code will cure this.

John

"Kingtriotn " wrote in message
...
I dont understand, if the cells are unlocked and the sheet is protected,
you can still manipulate the unlocked cells, only the locked cells are
protected when the sheet is protected. I will be distributing this
worksheet to a bevy of computer illeterate people who work for me and I
need it to be SIMPLE for them to use. I could just record a macro and

holding
control, select every cell that I want to delete, then hit delete, stop
recording macro and then link it to a button. I want to avoid this
because it makes the sheet move around when you run the sub. Even if I
delete all of the scroll lines in the sub, the sheet still appears to
have a seizure.
Thanks,
Kingtriton


---
Message posted from http://www.ExcelForum.com/