Hi, so I want to check 5 different cells on an excel worksheet against pre-defined rules. Some of the cells wont be populated, but I want any change to check against a condition a generate a pop-up. I've tried creating a VBA script for it, but can't get it to work:
Any help would be greatly appreciated.
Thanks!
Code:
Private Sub Worksheet_change(ByVal Target As Range)Dim FICO As Range
Dim CoFICO As Range
Dim Underwater As Range
Dim State As Range
Dim Units As Range
Set FICO = Intersect(Target, Range("$C$8"))
Set CoFICO = Intersect(Target, Range("$C$9"))
Set Underwater = Intersect(Target, Range("$C$13"))
Set State = Intersect(Target, Range("$C$17"))
Set Units = Intersect(Target, Range("$C$18"))
For Each FICO In FICO
If FICO.Value < 500 Then MsgBox "FICO Minimum of 500 for both 1st Alliance and Montage"
If Target.Value < 560 Then MsgBox "FICO Minimum of 560 needed for Montage"
Next FICO
For Each CoFICO In CoFICO
If Target.Value = 500 Then MsgBox "FICO Minimum of 500 for both 1st Alliance and Montage"
If Target.Value < 560 Then MsgBox "FICO Minimum of 560 needed for Montage"
Next CoFICO
For Each Underwater In Underwater
If Target.Value <= 1 Then MsgBox "Borrower must be underwater"
Next
For Each State In State
If Target.Value = "ID" Then MsgBox "ID excluded from First Alliance"
If Target.Value = "MO" Then MsgBox "MO excluded from First Alliance"
If Target.Value = "NV" Then MsgBox "NV excluded from First Alliance"
If Target.Value = "WV" Then MsgBox "WV excluded from First Alliance"
If Target.Value = "HI" Then MsgBox "HI excluded from First Alliance"
If Target.Value = "MS" Then MsgBox "MS excluded from Montage"
Next
For Each Units In Units
If Target.Value > 4 Then MsgBox "Fail: The maximum number of units allowed is 4"
Next
End Sub
Any help would be greatly appreciated.
Thanks!