View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Clearing Contents of all "unprotected" Cells.

Casey

Try this.....clears contents of unlocked cells on all worksheets.

Adapt to suit.

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

Gord Dibben Excel MVP

On Thu, 5 Aug 2004 17:31:08 -0500, Casey
wrote:

To the Great and Wise VBA Gurus,

Is there a VBA routine that would "clear contents" out of all the
unprotected cells on a worksheet, that could use the "UsedRange"
property so that it could be utilized on worksheets of differing
sizes?

Many thanks in advance
Casey


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