View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Paul B Paul B is offline
external usenet poster
 
Posts: 709
Default Selecting only unlocked cells to clear

Norman, my bad, yes you can do it, must have been to early in the morning
:)

--
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

"Norman Jones" wrote in message
...
Hi Paul,

Can you not clear unlocked cells without unprotecting / reprotecting the
worksheet?


---
Regards,
Norman



"Paul B" wrote in message
...
Randy, here is one way,

Sub Clear_Unlocked_Cells()
Dim Cel As Range
Const Password = "123" '**Change password here**
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:=Password
For Each Cel In Range("A1:N25")
If Cel.Locked = False Then Cel.Formula = ""
Next
ActiveSheet.Protect Password:=Password
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

"RAP" wrote in message
...
Hello,
Can anyone give me the VB code to select all the unlocked-only cells on

a
page or in a defined range, to clear them?

Thanks,
Randy