Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. I am trying to clear the contents of all unprotected cells only on a
protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like:
Sub Test() Dim c As Range For Each c In ActiveSheet.UsedRange.Cells If Not c.Locked Then c.ClearContents Next End Sub -- Vasant "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for each cell in activesheet.UsedRange
if cell.locked = false then cell.Clearcontents end if Next -- Regards, Tom Ogilvy "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, it worked!
"Vasant Nanavati" wrote: Something like: Sub Test() Dim c As Range For Each c In ActiveSheet.UsedRange.Cells If Not c.Locked Then c.ClearContents Next End Sub -- Vasant "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that did it!
"Tom Ogilvy" wrote: for each cell in activesheet.UsedRange if cell.locked = false then cell.Clearcontents end if Next -- Regards, Tom Ogilvy "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
I've implemented the code you supplied for Ed, however, some of the cells involved are merged and Error 1004 appears and says "Cannot change part of a merged cell". Any ideas? Thanks in advance! "Tom Ogilvy" wrote: for each cell in activesheet.UsedRange if cell.locked = false then cell.Clearcontents end if Next -- Regards, Tom Ogilvy "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
change:
cell.Clearcontents to cell.value = "" RemySS wrote: Tom, I've implemented the code you supplied for Ed, however, some of the cells involved are merged and Error 1004 appears and says "Cannot change part of a merged cell". Any ideas? Thanks in advance! "Tom Ogilvy" wrote: for each cell in activesheet.UsedRange if cell.locked = false then cell.Clearcontents end if Next -- Regards, Tom Ogilvy "Ed" wrote in message ... Hi. I am trying to clear the contents of all unprotected cells only on a protected worksheet. Any ideas how to do it without giving the absolute cell reference for each of the unprotected cells I want to clear? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clear Contents Of Cells Where Value = 0 | Excel Worksheet Functions | |||
Macro to clear contents of unprotected cells AND drop down boxes | Excel Discussion (Misc queries) | |||
How do I delete the contents of unprotected cells only? | Excel Discussion (Misc queries) | |||
Clear Contents - NonBold cells | Excel Discussion (Misc queries) | |||
Delete contents of unprotected cells in workbook | Excel Worksheet Functions |