This post will show you how to compare cells and display message box if condition is true.

I will show you how to:

-how to assign values to your variables _

-how to loop through rows _

-how to evaluate cell value with if statement

In the following image, the cells in columns A and B are being looped and the 2 cell values and being compared. When the condition is met, a message box will appear telling the row the condition is met on.

Sub Button1_Click() Dim intRow As Integer Dim intCellA As Integer Dim intCellB As Integer For intRow = 1 To 14 intCellA = Range("A" & intRow) intCellB = Range("B" & intRow) If intCellA > intCellB Then MsgBox "On row " & intRow & ", Cell A value is greater than Cell B" End If Next MsgBox "End.", vbInformation, "Complete" End Sub 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Sub Button1_Click ( ) Dim intRow As Integer Dim intCellA As Integer Dim intCellB As Integer For intRow = 1 To 14 intCellA = Range ( "A" & intRow ) intCellB = Range ( "B" & intRow ) If intCellA > intCellB Then MsgBox "On row " & intRow & ", Cell A value is greater than Cell B" End If Next MsgBox "End." , vbInformation , "Complete" End Sub

Watch how I do it:

Let me know if you have any questions

****************************************************