1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub essai()
Dim dercol, x, y, z, w
y = 10: w = 1
With Sheets("feuil1")
dercol = .Range("IV1").End(xlToLeft).Column
.Range("A9") = .Range("A3")
For x = 2 To dercol - 1
If .Cells(3, x) <> .Cells(3, x + 1) Then
.Range("A" & y) = .Cells(3, x + 1): y = y + 1
End If
Next x
For x = 9 To y - 1
z = Application.WorksheetFunction.CountIf(.Range(.Cells(3, 1), .Cells(3, dercol)), .Range("a" & x))
.Range("B" & x) = Application.WorksheetFunction.SumIf(.Range(.Cells(1, w), .Cells(1, w + z - 1)), "V", .Range(.Cells(2, w), .Cells(2, w + z - 1)))
w = w + z
Next x
End With
End Sub |
Partager