title: How to do an error handling block inline like Try/Catch
body: <p>How would I do an inline error handling routine in VBA? I don't want to put the error handler at the end.</p>
  
  <p>This is from <a href="http://www.cpearson.com/excel/errorhandling.htm" rel="nofollow noreferrer">CPearson's Error Handling in VBA</a></p>
  
  <pre><code>Sub testErrHandling()
      On Error GoTo ErrHandler:
  
      Debug.print 9 / 0 'divide by zero error
  
      Worksheets("NewSheet").Activate 'missing worksheet error
  
      'more code here
  
      Exit Sub
  
  ErrHandler:
      If Err.Number = 9 Then
          ' sheet does not exist, so create it
          Worksheets.Add.Name = "NewSheet"
          ' go back to the line of code that caused the problem
          Resume
      End If
  End Sub
  </code></pre>
  
  <p>But I'm looking for something more like a Try/Catch block in VB.net</p>