codice:
On Error Goto CodiceErrore
..
..
exit sub
CodiceErrore:
If Err.Number = 2147467259 Then 
     msgbox ("campo doppio")
end if
oppure

codice:
On Error Goto CodiceErrore
..
..
exit sub
CodiceErrore:
Select Case Err.Number
        Case 1
            ..
        Case 2
            ..
        Case Else
            Err.Clear
    End Select