Sub insert_pn()
'
' insert_pn Macro
'
'
Dim rngCell As Range
Dim strValueColC As String
Const CstrAjout As String * 3 = 'PN-'
For Each rngCell In Range('A3:A100')
With rngCell
If Not .Value = Empty Then
' Met en variable la valeur de la même ligne de la colonne C
strValueColC = Cells(.Row, 3)
' Vérifie la longeur de la valeur
Select Case Len(strValueColC)
Case Is < 4 ' Si plus petit que 4, ajoute un 0
strValueColC = '0' & strValueColC
Case Is > 4 ' Si plus grand que 4, tronque a 4 chiffre
strValueColC = Mid(strValueColC, 1, 4)
End Select
.Value = CstrAjout & .Value & '/' & strValueColC
End If
End With
Next rngCell
End Sub