Remplir matrice selon un programme

Bonjour,

Aider moi SVP, Je veux remplir la matrice selon le programme comme l'exemple en rouge et vert.

Merci d'avance. Et en cas des chevauchement on note deux au lieu de un comme l'exemple en couleur vert et maron

26matrice.xlsx (44.92 Ko)

Bonjour,

une solution via une macro, à tester

Sub test()
    Cells(1, 1) = 1
    For i = 3 To 33
        c1 = 6
        While Cells(2, c1) < Cells(i, 4)
            c1 = c1 + 1
        Wend
        c2 = c1
        While Cells(2, c2) <= Cells(i, 5)
            c2 = c2 + 1
        Wend
        c2 = c2 - 1
        Cells(1, 1) = 1
        Cells(1, 1).Copy
        Range(Cells(c1, c1), Cells(c2, c2)).PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd
        Range(Cells(c1, c1), Cells(c2, c2)).Interior.Color = Cells(i, 4).Interior.Color
    Next i
    Cells(1, 1) = ""
End Sub

Merci beaucoupppppppppppppppp

Rechercher des sujets similaires à "remplir matrice programme"