title: Worksheet Change Event - check cells in column for % difference
body: <p>I am struggling to get a Worksheet_Change event to work with the goal of checking if there is a % difference greater than 10% between range G12:42 and range J12:42. I have a calculation in range G12:42, which seems to be causing me some of the headache.</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
      Dim diffPercent
      'Check that the data is changed between row 12 and 42 and it is even row. eg 12,14,16...42.
      If (Target.Row &gt; 12 And Target.Row &lt; 42) And ((Target.Row Mod 2) = 0) Then  'And _
              '(Target.Column = 7 Or Target.Column = 10) Then
  
          'Get the values in J ang G columns of that particular row.
          number1 = Range("G" &amp; Target.Row).Value
          number2 = Range("J" &amp; Target.Row).Value
  
          'Check for presence of both the inputs to calculate difference in percentage.
          If Not chkInputs(number1, number2) Then
              Exit Sub
          End If
          'Calculate the percentage difference.
          diff = number2 - number1
          diffPercent = (diff / number2) * 100
  
          'Give alert if difference more than 10 percent
          If diffPercent &gt; 10 Then
              MsgBox "Oppps. Your system is not working!"
          End If
      End If
  
  End Sub
  
  Function chkInputs(number1, number2)
  chkInputs = False
  If IsNumeric(number1) And IsNumeric(number2) Then
      chkInputs = True
  End If
  
  End Function
  </code></pre>
  
  <p>The expected result is the triggering of a MsgBox providing a message.</p>