Hey everyone,
I am having some issues with a message box popping up 3 times for each scenario in the code below. I tried using Boolean values as explained in similar posts, but that just made the problem worse.
Basically, there are two cells in question. I'd like for one message ("A") to pop up if the first cell reads "Expanded" and the other does not. And another, different message ("B") to pop up in the opposite scenario. Lastly, a third message will pop up in the case where both cells read "Expanded"
Thanks
I am having some issues with a message box popping up 3 times for each scenario in the code below. I tried using Boolean values as explained in similar posts, but that just made the problem worse.
Basically, there are two cells in question. I'd like for one message ("A") to pop up if the first cell reads "Expanded" and the other does not. And another, different message ("B") to pop up in the opposite scenario. Lastly, a third message will pop up in the case where both cells read "Expanded"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim topcoattxt As String
Dim primertxt As String
topcoattxt = ActiveSheet.Range("B10").Text
primertxt = ActiveSheet.Range("B11").Text
If topcoattxt = "Expanded" And primertxt <> "Expanded" Then
MsgBox ("A")
End If
If primertxt = "Expanded" And topcoattxt <> "Expanded" Then
MsgBox ("B")
End If
If topcoattxt = "Expanded" And primertxt = "Expanded" Then
MsgBox ("These C")
End If
End Sub
Thanks