10/18/2019 - 11:35 PM

Error handling

Example sub showing how errors are handled in VBA

 Private Sub exampleSubroutine()
  On Error GoTo errorHandling
  ' code here
  Exit Sub ' required to keep error code from triggering falsely
  MsgBox "Display error"
  End ' ends all macros both outer & inner and returns to excel immediately
End Sub