View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I delete only the content of cells that are NOT protected?

Sub UnlockedCells()
Dim cl As Range
For Each cl In ActiveSheet.UsedRange
If cl.Locked = False Then
cl.ClearContents
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Fri, 16 May 2008 20:39:00 -0700, DrDisk7
wrote:

In a selected range of a partial or whole worksheet, is there a way to clear
the content of the cells which are selected but are NOT protected (or not
marked as "locked" in an unprotected sheet) while keeping all formats and
locked/protected cells in that range untouched. -- Is there a way to disable
the protection error so that the delete/clear command can go and do its job
on the unprotected cells? Even the earliest spreadsheets had it! Is Excel too
restricted?