Sub name_unprotected_range_each_sheet()
'Erik Van Geit
'051031
'to clear at once the contents off all unprotected cells on a worksheet
'you need to name the range with those cells
'when to much areas, code will bug
Dim UA As Range
Dim C As Range
Dim WS As Worksheet
For Each WS In Worksheets
Set UA = Nothing
For Each C In WS.UsedRange
If C.Locked = False Then
If UA Is Nothing Then Set UA = C Else Set UA = Union(UA, C)
End If
Next C
If Not UA Is Nothing Then _
WS.Names.Add Name:="UnprotectedArea", RefersTo:="=" & UA.Address
Next WS
End Sub
Sub clear_it()
'clears unprotected range on the activesheet
Range("UnprotectedArea").ClearContents
End Sub