ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Delete contents of unprotected cells in workbook (https://www.excelbanter.com/excel-worksheet-functions/5842-delete-contents-unprotected-cells-workbook.html)

BD7447

Delete contents of unprotected cells in workbook
 
Hi,

I have a workbook with half a dozen protected pages. Within each page is a
range of unprotected cells.

What I'm trying to do is write a macro which will delete the contents of all
unprotected cells in the workbook. I've attempted writing this by selecting
each of the unprotected cells in each page, then deleting.

However, when I then assign the macro and run this, I get a runtime error
because I am attempting to delete content from a protected sheet.

Is there a simple way of doing what I want? Indeed, is there any way to do
what I want, without unprotecting the workbook? Or, should I incorporate
unprotecting and then reprotecting each sheet into the macro? I'd rather avoid
this if I can?

Many thanks

Don Guillett

try doing it sheet by sheet to delete but with a onerror resume next to
bypass the protected.

--
Don Guillett
SalesAid Software

"BD7447" wrote in message
...
Hi,

I have a workbook with half a dozen protected pages. Within each page is

a
range of unprotected cells.

What I'm trying to do is write a macro which will delete the contents of

all
unprotected cells in the workbook. I've attempted writing this by

selecting
each of the unprotected cells in each page, then deleting.

However, when I then assign the macro and run this, I get a runtime error
because I am attempting to delete content from a protected sheet.

Is there a simple way of doing what I want? Indeed, is there any way to

do
what I want, without unprotecting the workbook? Or, should I incorporate
unprotecting and then reprotecting each sheet into the macro? I'd rather

avoid
this if I can?

Many thanks





All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com