so I am trying my first private worksheet macro and having a problem with my second statement . if the 1st test passes everything works great. if the second test fails the message box just keeps repeating
Ideally I need multiple elseif statements for multiples tests like this :
thanks in advance for any help
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("b5") = "Loyalty2gether" And Range("S5") > Range("S6") Then [COLOR=#ff0000]( if this condition is met,works great message box pops up and macro stops)[/COLOR]
MsgBox "your quote does not qualify for the Loyalty2gether Promotion"
Range("b5").Value = "SBA Type"
Range("b7").Value = "Quantity of discounted 9608G phones cannot exceed total or core and power licenses"
ElseIf Range("b5") = "Loyalty2gether" And Range("S6") > Range("S5") Then ([COLOR=#ff0000]if this condition is met, the message box repeats completely and I need to control -break to stop)[/COLOR]
MsgBox "Your quote does qualify for the Loyalty2gether Promotion"
Range("B7").Value = "blah blah blah"[COLOR=#ff0000]( if i select debug after control -break, this row gets highlighted)[/COLOR]
End If
End Sub
Ideally I need multiple elseif statements for multiples tests like this :
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'popup if9608 greater thancore and powerusers
If Range("b5") = "Loyalty2gether" And Range("S5") > Range("S6") Then
MsgBox "your quote does not qualify for the Loyalty2gether Promotion"
Range("b5").Value = "SBA Type"
Range("b7").Value = "Quantity of discounted 9608G phones cannot exceed total or core and power licenses"
ElseIf Range("b5") = "Loyalty2gether" And Range("S6") > Range("S5") Then
MsgBox "Your quote does qualify for the Loyalty2gether Promotion"
Range("B7").Value = "blah blah blah"
ElseIf Range("b5") = "Now" And Range("S7") > Range("S8") Then
MsgBox "Your quote does qualify for the Now Promotion"
Range("B7").Value = "blah blah blah1"
ElseIf Range("b5") = "Now" And Range("S7") < Range("S8") Then
MsgBox "Your quote does not qualify for the Now Promotion"
Range("B7").Value = "blah blah blah2"
End If
End Sub
thanks in advance for any help