Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

Message Box when a cell changes to a specific value

$
0
0
Looked high and low for this one with not success even though I thought it would be very easy.

I use data validation to change the value of another cell. When that other cells value equals "N/A" I would like a pop up message to appear. I found something that was close but it kept popping up even when the target cell wasn't changed. There is another Worksheet_Change code before this one. Here is the current bit of code with the problem area in bold at the end:

Code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim rng As Range
  Set rng = Range("E24")
  If Not Intersect(Target, rng) Is Nothing Then
      If rng = "HIP-180DA3" Then
        MsgBox "Message"
      End If
      If rng = "HIP-186DA3" Then
        MsgBox "Message"
      End If
      If rng = "HIP-190DA3" Then
        MsgBox "Message"
      End If
      If rng = "HIP-195DA3" Then
        MsgBox "Message"
      End If
      If rng = "HIP-200DA3" Then
        MsgBox "Message"
      End If
  End If

  Set rng = Nothing

Set rng = Range("E33")
 If Not Intersect(Target, rng) Is Nothing Then
      If rng = "N/A" Then
        MsgBox "Message"
      End If

 
  End If
End Sub

Thanks for the help!

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>