Dim MaxVal As Integer
For a = 0 To DataGridView1.RowCount - 1
If MaxVal < DataGridView1.Item(DataGridView1.ColumnCount - 1, a).Value Then
MaxVal = CInt(DataGridView1.Item(DataGridView1.ColumnCount - 1, a).Value)
End If
Next
MsgBox("The Optimum Value is " & MaxVal, 1, "Optimum Choice")