I wrote the following code to look at each cell in a range and give a message box if the maximum amount is exceeded. The code is looking at each cell in the range, but I get the message box no matter what the amount is. (I get the message for any amount, including zero.) What I need is to change this code so that I only get the message box if the amounts in the range exceed 99,999,999.99. Can anyone tell me where my code needs to be changed?
For Each Cell In MyCell.CurrentRegion.Cells
If Cell.Value > 99999999.99 Then
Msg1 = "Fund exceeds maximum allowed."
Title = "Alert"
Style = vbOKOnly
MsgResponse = MsgBox(Msg1, Style, Title)
If MsgResponse = vbOK Then
Exit Sub
End If
End If
Exit For
Next Cell
For Each Cell In MyCell.CurrentRegion.Cells
If Cell.Value > 99999999.99 Then
Msg1 = "Fund exceeds maximum allowed."
Title = "Alert"
Style = vbOKOnly
MsgResponse = MsgBox(Msg1, Style, Title)
If MsgResponse = vbOK Then
Exit Sub
End If
End If
Exit For
Next Cell