title: Error handling in VBA - on error resume next
body: <p>I have the following code:</p>
  
  <pre><code>ErrNr = 0
  For Rw = StRw To LsRw 'ToDo speed up with fromrow torow
      If Len(ThisWorkbook.Sheets(TsSh).Cells(Rw, TsCl)) = 0 Then
          ThisWorkbook.Sheets(TsSh).Cells(Rw, TsCl).Interior.ColorIndex = 46
          ErrNr = ErrNr + 1
      End If
  Next
  </code></pre>
  
  <p>My problem is if there is an error on the page, my code is not running after that. I think the solution should be with:</p>
  
  <pre><code>On Error Resume Next
  N = 1 / 0    ' cause an error
  If Err.Number &lt;&gt; 0 Then 
      N = 1
  End If
  </code></pre>
  
  <p>But I don't know how to use this code.</p>