Dim StrFacture$, ID As Integer, AnneeFacture As Integer
StrFacture = 1
With Sheets("Devis")
If .Range("J9") <> Empty Then
ID = Right(.Range("J9"), 4) 'on récupére l'index de la facture
AnneeFacture = Mid(.Range("J9"), 2, 4) 'on récupére l'année du Numéro de la Facture
End If
End With
StrFacture = IIf(Int(Year(Date)) = Int(AnneeFacture), Int(ID) + 1, StrFacture)
Range("J9") = "F" & Format(Date, "yyyy-mm-") & Format(StrFacture, "0000")
StrFacture = Empty