How to clearcontents of a merged cells How to clearcontents of a merged cells vba vba

How to clearcontents of a merged cells


You need Cells not Range:

ws.Cells(j, l).ClearContents

Oops - forgot about the merged bit:

        If Cells(j, l).MergeCells Then            Cells(j, l).MergeArea.ClearContents        Else            Cells(j, l).ClearContents        End If


Try

Range("A1:A20").Value = ""

No matter cells are merged or not this will work everytime.


Range("").value = ""