Trying to figure out how to incorporate a CONDITIONAL message appropriately.
If ANY CELLS in COL "x" were = "0" then display this message "xxx"
Else display this other message "xxx"...
If I simply insert the message under the conditional code section, it pops the message up after every row it loops through --- of course, I do NOT want that ---
*I need it to be smart enough to know if it found any zeros or not after looping through the full column and at the END -- display the appropriate message once!
If ANY CELLS in COL "x" were = "0" then display this message "xxx"
Else display this other message "xxx"...
If I simply insert the message under the conditional code section, it pops the message up after every row it loops through --- of course, I do NOT want that ---
*I need it to be smart enough to know if it found any zeros or not after looping through the full column and at the END -- display the appropriate message once!
Code:
Sub ChangeColorWMssg()
'TURNS THE FIRST VALUE = TO 0 GREEN
'TURNS THE 2ND VALUE GREATER THAN 0 RED
'The "cel.Resize(,1)" means that it will turn ONLY 1 CELL that color
Application.ScreenUpdating = False
Dim lRow As Long
lRow = Range("C" & Rows.count).End(xlUp).Row
Dim MR As Range
Set MR = Range("C2:C" & lRow)
Dim cel As Range
For Each cel In MR
If cel.Value = "0" Then
cel.Resize(, 1).Interior.Color = RGB(0, 128, 0)
MsgBox ("Zero values were discovered. Do not delete these, they'll be used during File Mtc.")
ElseIf cel.Value > "0" Then
cel.Resize(, 1).Interior.Color = RGB(255, 0, 0)
MsgBox ("No Zero values were found. Proceed with your TO to BOM validation.")
End If
Next
Application.ScreenUpdating = True
End Sub