Hi, I have a sample code here for you to try. It does everything you said except telling which cell is incorrect, but I'm working on that. Is the formatting of the msgbox okay? This will give you all the errors in one msgbox instead of multiple popping up.
Sub test()
Dim x As Long
Dim y As Long
Dim z As Long
x = Range("A" & Rows.Count).End(xlUp).Row
x = Application.WorksheetFunction.CountIf(Range("A2:A" & x), "Yes")
y = Range("B" & Rows.Count).End(xlUp).Row
y = Application.WorksheetFunction.CountIf(Range("B2:B" & y), "Yes")
z = Range("C" & Rows.Count).End(xlUp).Row
z = Application.WorksheetFunction.CountIf(Range("C2:C" & z), "Yes")
If x <> 0 And y <> 0 And z <> 0 Then
MsgBox ("Incorrect Code, Incorrect Amount, and Not Matching")
ElseIf x <> 0 And y <> 0 Then
MsgBox ("Incorrect Code and Incorrect Amount")
ElseIf x <> 0 And z <> 0 Then
MsgBox ("Incorrect Code and Not Matching")
ElseIf y <> 0 And z <> 0 Then
MsgBox ("Incorrect Amount and Not Matching")
ElseIf x <> 0 Then
MsgBox ("Incorrect Code")
ElseIf y <> 0 Then
MsgBox ("Incorrect Amount")
ElseIf z <> 0 Then
MsgBox ("Not Matching")
End If
End Sub
Bookmarks