ExcelMercy
Board Regular
- Joined
- Aug 11, 2014
- Messages
- 151
Alrighty, I'm trying to backcolor (interior color) certain rows that match certain text. I'm trying to use an array mixed with a case. I'm getting an error... Any ideas?
Rich (BB code):
Dim ColorArray1 As Variant
Dim ColorArray2 As Variant
ColorArray1 = Array("Brown1", "Brown2", "Brown3", "Brown4")
ColorArray2 = Array("Yellow1", "Yellow2", "Yellow3", "Yellow4", "Yellow5", "Yellow6", "Yellow7")
Dim C As Long, ColorValue As Long
For C = 2 To Cells(Rows.Count, "A").End(xlUp).Row
Select Case Cells(C, "D").Value
Case ColorArray1: ColorValue = RGB(148, 138, 34)
Case ColorArray2: ColorValue = RGB(255, 255, 0)
Case Else: ColorValue = xlNone
End Select
Rows(C).Interior.Color = ColorValue
Next