Option Explicit
Sub IIF_imbriqué()
Dim Dl As Long, NbLig As Long, j As Long, Compte
Dl = Range("A" & Rows.Count).End(xlUp).Row
NbLig = Dl - 1
For j = 2 To NbLig * 3
Compte = IIf(j <= NbLig + 1, "627002", IIf(NbLig + 1 > j >= NbLig + 1 * 2, "580002", "512002"))
.Cells(j, 3) = Compte
.Cells(j, 3).NumberFormat = "General" 'on format cellule car excel convertit chiffre en date
Next j
End Sub