check for string in cell with formula,case statement

  • hi,i have this code for checking $I$1 for two certain values ("live" and "z") and do the precedures


    the problem is that cell $I$1 has formula

    Code
    IF(COUNTIF(M1:M10,"*live*")>0,"live","z")

    and the code doesn't work.if i put these values manualy it works fine.what should i change?i am stuck

  • Since the value in I1 is the result of a formula, a Worksheet_Change event will not be triggered automatically. You need a Worksheet_Calculate event.


    Code
    Private Sub Worksheet_Calculate()
        Select Case Range("I1").Value
            Case "live"
                Call testup1
                Call UpdateData
            Case "z"
                Call StopButton_Click
                Call StopButton_Click2
        End Select
    End Sub

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • You are very welcome. :)

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!