Why not use:
For f As Integer = 0 To DataGridView1.Rows.Count - 1
Dim num As Integer = Val(DataGridView1.Rows(f).Cells(1).Value)
If num > 10000 Then
DataGridView1.Rows(f).DefaultCellStyle.BackColor = Color.Red
End If
Next
Or:
For Each row As DataGridViewRow In DataGridView1.Rows
Dim num As Integer = Val(row.Cells(1).Value)
If num > 10000 Then
row.DefaultCellStyle.BackColor = Color.Red
End If
Next