Testing your code here.
I have a standard DataGridView on Form1 with 7 columns and a standard Button. Added some random data (see code). Put your code into the Button.Click event Handler and changed a couple of lines in your code as they were redundant for this test.
Here is all the code I used for testing. I got the correct cell style changes and a MessageBox pop-up with a list of overdue.
NOTE: to satisfy the Option Strict, I had to add a Cint() to one occurrance and convert to string in another. (cell contents are type Object)
Option Strict On Option Explicit On Public Class Form1 Dim strmileagemax As Integer = 10000 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click DataGridView1.Rows.Clear() Dim r As New Random Dim lst As String = "Overdue items: " For i As Integer = 1 To 10 With DataGridView1 .Rows.Add(Nothing, i, Nothing, Nothing, Nothing, Nothing, r.Next(9995, 10010)) End With Next For i As Integer = 0 To DataGridView1.Rows.Count - 1 If CInt(Me.DataGridView1.Rows(i).Cells(6).Value) > strmileagemax Then Me.DataGridView1.Rows(i).Cells(6).Style.BackColor = Color.Red Me.DataGridView1.Rows(i).Cells(6).Style.ForeColor = Color.White Me.DataGridView1.Rows(i).Cells(6).ToolTipText = "OIL CHANGE DUE" 'strcarNumber1 = Me.DataGridView1.Rows(i).Cells(1).Value 'stremailsubject = strcarNumber1 ' MsgBox("Mileage " & stremailsubject) lst &= Me.DataGridView1.Rows(i).Cells(1).Value.ToString & " " End If Next MessageBox.Show(lst) End Sub End Class