title: Application-defined or object-defined error IF statement
body: <p>I get Run-time error '1004' Application-defined or object-defined error.
  it get's stuck on this If statement</p>
  
  <pre><code>If Cells(rownumber2, 2).Value &lt;&gt; 1 Then
  </code></pre>
  
  <p>Any help would be appropriated</p>
  
  <pre><code>Sub stock()
  Application.ScreenUpdating = False
  Dim rownumber As Long
  Dim rownumber2 As Double
  Dim rng As Range, i As Range, j As Range, rng2 As Range
  rownumber = 0 'Machining 900#
  rownumber2 = 1 'maximo 900#
  Set rng = Range("j1:j1910")
  Set rng2 = Range("A2:A62685")
  For Each i In rng
      rownumber = rownumber + 1
      For Each j In rng2
      rownumber2 = rownumber2 + 1
      If i = j Then
          If Cells(rownumber2, 2).Value &lt;&gt; 1 Then
          'If (IsNumber(Search("*Active*", Cells(rownumber2, 2)))) Then
              Cells(rownumber, 10).Interior.ColorIndex = 5
          Exit For
          End If
          Exit For
      End If
   Next
  Next
  Application.ScreenUpdating = True
  End Sub
  </code></pre>