Would anyone know how to include merged cells into this clear?
I need to clear all unprotected cells in a worksheet. (if you have something that already works would you share?)
I need to clear all unprotected cells in a worksheet. (if you have something that already works would you share?)
Code:
Sub cleartestall() Dim r As Range, rcleara As Range
Set rclear = Nothing
For Each r In ActiveSheet.UsedRange
If r.Locked = False Then
If rcleara Is Nothing Then
Set rcleara = r
Else
Set rcleara = Union(rcleara, r)
End If
End If
Next r
rcleara.clear
End Sub