numérotation par étapes

nico12

XLDnaute Nouveau
Bonjour à tous, je souhaite obtenir une numérotation, d'après des cellules existantes, par étapes, en incluant des séparations.
Un exemple ?
voici !
merci de votre aide ,
 

Pièces jointes

  • increment1.xlsx
    9.2 KB · Affichages: 10

Paf

XLDnaute Barbatruc
Bonjour,

une solution à tester:

VB:
Private Sub CommandButton1_Click()
Dim WS1 As Worksheet, WS2 As Worksheet, x As Long, i As Long, j As Long, lig As Long

Set WS1 = Worksheets("Feuil1")
Set WS2 = Worksheets("Feuil2")
With WS1
For x = 3 To .Range("A" & Rows.Count).End(xlUp).Row  'lignes
    For i = .Cells(x, 1) To .Cells(x, 2) Step .Cells(x, 4)
        For j = i To i + .Cells(x, 4) - 1
            lig = lig + 1
            WS2.Cells(lig, 1) = j
            WS2.Cells(lig, 2) = .Cells(x, 3)
        Next
        lig = lig + 1
        WS2.Cells(lig, 1) = "Inter"
        WS2.Cells(lig, 2) = "Inter"
    Next
 Next
 End With
End Sub

A+
 

Discussions similaires

Statistiques des forums

Discussions
312 188
Messages
2 086 028
Membres
103 100
dernier inscrit
erym64300