I want to check through multiple years worth of data sheets to find specifically colored cells.
Humans have not consistently chosen the same cell color throughout the years (they may all be the same to the human eye, but have different RGB values).
If I have a cell with the interior color RGB(255,23,50), is there a way to create a color vector to see if a cell's interior color falls on it? I am looking to create a vector with +/- 15 RGB points, so if I am searching for cells with RGB(255,23,50) I want a vector between RGB(255,38,65) and RGB(240,8,35).
I could use an IF statement to see if the color falls between those two values, but I could use a color vector for more applications (and the code would be easier to modify if it needed to be changed).
This if statement works:
If ActiveWorkbook.Worksheets("Sheet1").Range("e5").Interior.Color >= RGB(240, 8, 35) And ActiveWorkbook.Worksheets("Sheet1").Range("e5").Interior.Color <= RGB(255, 38, 65) Then
MsgBox ("yes")
Else
MsgBox ("no")
End If
I am looking for something more along the lines of:
dim redVector as long ' or other appropriate variable type
' ***** code that defines the red vector *****
if range("e5").interior.color = redVector then
' do stuff
end if