Clearing unlocked cells
I get this message when trying. What am I doing wrong? Compile error.
Expected end sub.
' Macro1 Macro
' Macro recorded 3/7/2006 by David Walters
'
' Keyboard Shortcut: Ctrl+n
'
Sub Clear_Unlocked()
Dim rngeCell As Range
Application.ScreenUpdating = False
For Each rngeCell In ActiveSheet.UsedRange.Cells
If rngeCell.Locked = False Then rngeCell.ClearContents
Next
Application.ScreenUpdating = True
End Sub
"Paul B" wrote:
fshew, try this,
Sub Clear_Unlocked()
Dim rngeCell As Range
Application.ScreenUpdating = False
For Each rngeCell In ActiveSheet.UsedRange.Cells
If rngeCell.Locked = False Then rngeCell.ClearContents
Next
Application.ScreenUpdating = True
End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
"fshew" wrote in message
...
How can I clear unlocked cells and leave the locked ones. I tried a macro
but what I am trying to clear was to large for the macro.
|