Clearing Contents of all "unprotected" Cells.

C

Casey

To the Great and Wise VBA Gurus,

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

Many thanks in advance
Case
 
G

Gord Dibben

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
 
C

Casey

Gord,
A million thanks, our internet access has been down and I couldn't ge
back here to see if any one had replied. I try not to ask for cod
without a least first trying something on my own. But this was kind o
an emergency and you have made my day. Again, thank you

Case
 

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