Reputation: 532
I have conditional formatting which makes cells gray if they are inapplicable and green if they apply.
Can I apply "clear contents" to a range of cells if they are grey?
Much appreciated
Upvotes: 0
Views: 1169
Reputation:
You can apply the code below to all the cells in the given range:
Dim targetIndex As Integer
targetIndex = 16 'one grey
If (ActiveCell.Interior.ColorIndex = targetIndex) Then
ActiveCell.ClearContents
End If
You have to determine what you consider "grey". You might even include different indices just to make sure. Here you have a useful link with the indices associated with all the colours.
Upvotes: 1