title: VBA function with "On Error GoTo error" always fall on error
body: <p>Can we use : <code>On Error GoTo ...</code> in a VBA <strong>function</strong> ?</p>
  <p>I always use it to manage my eventual error inside my Sub but when I use it inside a function it's like it didn't work as expected and always go through. When I remove it the function work well.</p>
  <p>There is a specific way to manage error in function ?</p>
  <p><strong>EDIT</strong></p>
  <p>Here is an exemple of one of my function :</p>
  <pre><code>Function Row_Nbr_In_Sheet(shtName As String) As Integer
    On Error GoTo ErrorManager
    
    Row_Nbr_In_Sheet = ThisWorkbook.Worksheets(shtName).UsedRange.Rows.Count
  
  ErrorManager:
    MsgBox(&quot;Something weird here&quot;)
    End
  End Function
  </code></pre>
  <p>this function work well without &quot;GoTo&quot; but it trigger the MsgBox when I use it. It's exactly the same for each functions of my code.</p>