Error handling in VBA makes a macro robust against unexpected events: missing file, invalid value, division by zero. You use On Error GoTo to a handling label, which frees resources and warns the user, or On Error Resume Next sparingly because it hides errors. The Err object gives the error number and description.
Example
On Error GoTo Gestion ' ... code ... Exit Sub Gestion: MsgBox "Error: " & Err.Description