1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub repartition()
Dim Dl As Integer, x As Integer, y As Integer, i As Integer
Dim InscritS1(), inscritS2(), S1
With Sheets("Feuil1")
Dl = .Range("A" & .Rows.Count).End(xlUp).Row
If WorksheetFunction.IsEven(.Range("A" & Dl)) Then
S1 = .Range("A" & Dl) / 2
ReDim InscritS1(1 To S1, 1 To 8): ReDim inscris2(1 To S1, 1 To 8)
Else
S1 = Int(.Range("A" & Dl) / 2) + 1
ReDim InscritS1(1 To S1, 1 To 8): ReDim inscritS2(1 To S1 - 1, 1 To 8)
End If
i = 0
For x = 7 To Dl Step 2
i = i + 1
For y = 1 To 8
If x < Dl Then
InscritS1(i, y) = .Cells(x, y)
inscritS2(i, y) = .Cells(x + 1, y)
Else
InscritS1(i, y) = .Cells(x, y)
End If
Next y
Next x
End With
With Sheets("Séries")
.Range("A7").Resize(UBound(InscritS1, 1), UBound(InscritS1, 2)) = InscritS1
.Range("J7").Resize(UBound(inscritS2, 1), UBound(inscritS2, 2)) = inscritS2
End With
End Sub |
Partager