Sub ZéroDevant()
Dim l&, n&, Cel As Range
l = Val(InputBox("Longueur du code ?", , 4))
If l > 1 Then
For Each Cel In Selection.Cells
With Cel
If Not IsEmpty(.Value) Then
If IsNumeric(.Value) Then
If Len(CStr(.Value)) < l Then
.Value = "'" & Right$(String(l, "0") & CStr(.Value), l)
n = n + 1
ElseIf Len(CStr(.Value)) = l Then
.Value = "'" & CStr(.Value)
End If
End If
End If
End With
Next
End If
MsgBox IIf(n, n, "Aucun") & " code" & IIf(n > 1, "s", "") & " modifié" & IIf(n > 1, "s", "") & "."
End Sub