Excel color matching rows

  • Thread starter Thread starter Ryutenkan
  • Start date Start date
R

Ryutenkan

Guest
Hello Community,

I have found many many great help here reading you.

This time i need your help because i can't apply any of the solution i have read.

i export to excel from datagridview.

i want to color rows if condition are met.

i can do it with 1 parameter. i'm stuck when i want to add a second condition.

Code working right now :

For Each Cell1 In Wb.Worksheets("Sheet1").Range("D2:D100")
For Each Cell2 In Wb.Worksheets("Sheet2").Range("D2:D100")
If Cell1.Text = Cell2.Text Then
Cell1.EntireRow.Interior.Color = ColorTranslator.ToOle(Color.Green)
End If
Next Cell2
Next Cell1

i want to add the condition that on sheet2 column F :

For each text equal to "40 Cm" and Cell1.Text = Cell2.Text from first condition then color

so it will color all rows on sheet1 that meets condition : text "40 Cm" and same Name in sheet2.

Thanks by advance

Continue reading...
 
Back
Top