I am trying to clear contents from cells but some of them are merged so I am getting the error
1004 :"We cant do that to merged 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
Another Try using .Cells
still it returns 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