title: VBA Excel Stop On Error Goto
body: <p>I have written <code>On Error GoTo ErrorMessage</code> somewhere in a subroutine. I want to stop this command after <code>End if</code> command as shown below.     </p>
  
  <pre><code>    On Error GoTo ErrorMessage
      Sheet2.Range("A1").Font.Bold = True
      Sheet2.Range("B1").Font.Bold = True     
      If LastRow_Sh2 &gt;= First_Row_Sheet2 Then
          Sheet2.Range(FromCol &amp; First_Row_Sheet2 &amp; ":" &amp; ToCol &amp; LastRow_Sh2).ClearContents
          Exit Sub
      End If
      ' Stop here
  
      ' I have some codes here
  
  ErrorMessage:
      MsgBox ("Error message: The input values are invalid")
  </code></pre>