Forum Discussion

AnnaS550's avatar
AnnaS550
Copper Contributor
Oct 05, 2021
Solved

How to get a pop-up message to show only for the intended column.

Hi. I am working on a sheet where i have 3 different pop-up messages to show for certain values in cells in a certain column. E.g. a value between 1-5 generates one message, a value between 6-10 ge...
  • HansVogelaar's avatar
    HansVogelaar
    Oct 05, 2021

    AnnaS550 

    Here you go:

     

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim total As Double
        If Target.CountLarge > 1 Then Exit Sub
        If Not Intersect(Range("C:D"), Target) Is Nothing Then
            Application.Calculate
            Application.EnableEvents = False
            total = Sheet1.Range("E" & Target.Row).Value
            If total >= 1 And total <= 5 Then
                Call MsgBox("Message 1-5.", vbOKOnly, "Evaluation")
            ElseIf total <= 10 Then
                Call MsgBox("Message 6-10.", vbOKOnly, "Evaluation")
            ElseIf total <= 15 Then
                Call MsgBox("Message 11-15.", vbOKOnly, "Evaluation")
            End If
            Application.EnableEvents = True
        End If
    End Sub
    

     

Resources