Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Green,
This seems to work. According to help MergeArea returns the merged area (so far so good) and if there is none it returns the cell: Dim rngCell As Range For Each rngCell In ActiveSheet.UsedRange If rngCell.Locked = False Then rngCell.MergeArea.ClearContents Next rngCell hth, Doug "green" wrote in message ... I am using VBA in Excel XP and Win 2k. I need to clear the contents of all cells on a sheet that are unlocked. The problem is, some cells may be merged. I have the following code that works great on unmerged cells, but how do I alter this code to also handle merged cells without generating an error? Dim rngCell As Range For Each rngCell In ActiveSheet.UsedRange If rngCell.Locked = False Then rngCell.ClearContents Next rngCell Please post your example code and thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clearing Contents | Excel Discussion (Misc queries) | |||
row height increase automatically to fit contents of merged cells | Excel Discussion (Misc queries) | |||
Clearing the Contents of Merged Cells | New Users to Excel | |||
Clearing Contents of Cell | Excel Worksheet Functions | |||
Clearing a merged cell | Excel Programming |