Hi
I want to clear content of cells in certain row if interior cell color is different than red. Columns I want to clear are C, D, F, H, J, K, L, M (not all).
I wrote below code and it works, but with bigger sheets it's quite slow and I'm looking for more efficient way for doing this.
I want to clear content of cells in certain row if interior cell color is different than red. Columns I want to clear are C, D, F, H, J, K, L, M (not all).
I wrote below code and it works, but with bigger sheets it's quite slow and I'm looking for more efficient way for doing this.
VBA Code:
Sub clear_cont()
Dim x, y As Integer
y = ActiveSheet.UsedRange.Rows.count
For x = 2 To y
If Cells(x, 1).Interior.Color <> RGB(255, 0, 0) Then
Cells(x, 3).ClearContents
Cells(x, 4).ClearContents
Cells(x, 6).ClearContents
Cells(x, 8).ClearContents
Cells(x, 10).ClearContents
Cells(x, 11).ClearContents
Cells(x, 12).ClearContents
Cells(x, 13).ClearContents
End If
Next x
End Sub