Use event CellFormatting
Dim cell As DataGridViewCell
If dataGridView.Rows(e.RowIndex).Cells(Index Cell To Compare).Value =1 Then
cell.Style.BackColor = Color.Green
Else If dataGridView.Rows(e.RowIndex).Cells(Index Cell To Compare).Value =2 Then
cell.Style.BackColor = Color.Yellow
End If