I would like to select all cells in the dataset A2:F156 where the color index is 19 (light orange) or 40 (dark orange). I have uploaded a picture of my dataset below.
I have compiled the following code:
Sub SelectByColor
Dim cell as range, rng as range
Set rng = range("A2:F841")
For each cell in rng
End Sub
Of course, it doesn't work and it just selects the last cell in the dataset, F156.
I have compiled the following code:
Sub SelectByColor
Dim cell as range, rng as range
Set rng = range("A2:F841")
For each cell in rng
If cell.Interior.ColorIndex = 19 or cell.Interior.ColorIndex = 40 Then
cell.select
End If
Next cellEnd Sub
Of course, it doesn't work and it just selects the last cell in the dataset, F156.