Clear contents of unprotected cells in entire workbook with a macr

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top