Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50067

Select cells by colorindex

$
0
0
Hello all,

I'd like to write a macro that selects all cells with a certain background. The color I'm looking for is (255,217,102). I want to select all cells in the sheet with this background color, and then change the value of these cells. I'm fairly certain this can be done, but I've never been great with VBA. This is what I'm trying so far:

Sub fff()
If Application.Cells.Interior.ColorIndex = RGB(255, 217, 102) Then
Application.Cells.Value = 0
End If

End Sub


0 is not the actual value I want but I've been using it to test.
Can someone please help me?

Viewing all articles
Browse latest Browse all 50067

Trending Articles