Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Seeing the other guys interruptions <g, your code is actually doubly
counter-productive. By adding the select you slow it down, but by your code logic If Not cell.Locked Then cell.Select Selection.ClearContents you not only do that but for non-locked cells you re-clear the last selected cell (unnecessarily most of the time, and if the usedrange starts with locked cells and you have a locked cell active, it will actually crash the code. Why did you add it? -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "NezRhodes" wrote in message ... GReat Bob, thank you. I added a couple of touches to your script to make it run a little quicker ... Sub test() Dim cell As Range Application.Calculation = xlManual For Each cell In ActiveSheet.UsedRange If Not cell.Locked Then cell.Select Selection.ClearContents Next cell Application.Calculation = xlAutomatic End Sub "Bob Phillips" wrote: Sub test() Dim cell As Range For Each cell In ActiveSheet.UsedRange If Not cell.Locked Then cell.ClearContents Next cell End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "NezRhodes" wrote in message ... Hello Gurus I would like to create some script that dynamically identifies unprotected cells in a worksheet and clears their contents Thanks in advance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
How do I Clear ALL unprotected data entry fields in a protected sh | Excel Programming | |||
Allow unprotected cells to spell check after sheet is protected | Excel Worksheet Functions | |||
Tab key don't work in unprotected cells in a protected sheet | Excel Discussion (Misc queries) | |||
Clear contents of unprotected cells in entire workbook with a macr | Excel Programming |