Hi. I wrote a code that goes through the rows of a every sheet in a workbook and finds the ones that have one of two colors, then copies that needed data from that row and pastes it into another tab that was created earlier in the macro. Essentially, it skips a row unless it's highlighted yellow (ColorIndex = 6) or a pinkish color, RGB(230, 184, 183). My macro works for the ColorIndex, but not for the RGB, no matter what the ColorIndex or RGB values are (I've tried different ones to be sure). I've even tried not doing it as an 'Or' and just doing the ColorIndex (which works) or just the RGB (which doesn't work). Am I not using the RGB correctly? See the relevant code below:
For j = 1 To sheetnum
For i = 5 To 100
Sheets(j).Activate
If Cells(i, 5).Interior.ColorIndex = 6 Or Cells(i, 5).Interior.Color = RGB(230, 184, 183) Then 'Looks for yellow and red cells
Cells(i, 4).Select
Range(Cells(i, 4), Cells(i, 11)).Copy
Sheets("Sourcing").Activate 'Switches to the Sourcing tab
ActiveSheet.Paste Destination:=Worksheets("Sourcing").Range(Cells(n, 2), Cells(n, 11))
'QT.Activate 'Goes back to QT sheet
n = n + 1 'next row
order = order + 1 'next order number
End If
Next i
Next j
Bookmarks