I'm trying to clear the contents of cells, but some of them are merged, so I get an error
1004: "We cannot do this to merge cells"
For l = 4 To 9
If ws.Cells(j, l).Interior.ColorIndex = 19 Then
ws.Range(j, l).ClearContents 'Error here
End If
Next l
Other Try using .Cells
, but it returns an error
For l = 4 To 9
If ws.Cells(j, l).Interior.ColorIndex = 19 Then
ws.Cells(j, l).ClearContents 'Error here
End If
Next l
source
share