Clear contents of unprotected cells in entire workbook with a macr

G

Guest

I am trying to write a macro that will clear the contents of all unprotected
cells for an entire workbook. How would I do this without giving the
absolute cell reference for each of the unprotected cells I want to clear?
(I found samples of code that will clear unprotected cells on the active
worksheet only but haven't been able to figure out how to apply this to all
sheet in the entire workbook.
 
T

Tom Ogilvy

Dim sh as Worksheet
Dim sh1 as Worksheet
Dim rng as Range
Application.ScreenUpdating = False
set sh1 = ActiveSheet
set rng = selection
for each sh in ActiveWorkbook.worksheets
sh.Activate
' code to clear unprotected cells on the active sheet
Next
Sh1.Activate
rng.Select
Application.ScreenUpdating = True
 

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