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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| Option Explicit
Public Lign, Lign2 As Long
Public Coln As Integer
Public SavSeq As Integer 'Sauvegarde N° de la séquence
Public CumSeq As Integer 'Cumul le Tps par séquence
'-----------------------------------------------------------------------
' Macro Tot_seq permettant de connaitre le début de la seq par personne
'-----------------------------------------------------------------------
Sub Tot_seq()
Call Entete_F2
Lign = 2
Lign2 = 2
Coln = 2
SavSeq = Cells(Lign, Coln).Value
CumSeq = 0
Do
If Cells(Lign, Coln).Value <> "" Then
If SavSeq = Cells(Lign, Coln).Value Then
CumSeq = CumSeq + Cells(Lign, Coln + 8).Value
Else
Sheets("Feuil2").Select
Cells(Lign2, 1).Value = Sheets("Feuil1").Cells(Lign, 1).Value
Cells(Lign2, 2).Value = SavSeq
Cells(Lign2, 3).Value = CumSeq
Sheets("Feuil1").Select
Lign2 = Lign2 + 1
SavSeq = Cells(Lign, Coln).Value
CumSeq = Cells(Lign, Coln + 8).Value
End If
Coln = Coln + 1
Else
Sheets("Feuil2").Select
Cells(Lign2, 1).Value = Sheets("Feuil1").Cells(Lign, 1).Value
Cells(Lign2, 2).Value = SavSeq
Cells(Lign2, 3).Value = CumSeq
Sheets("Feuil1").Select
Lign2 = Lign2 + 1
Lign = Lign + 1
SavSeq = Cells(Lign, 2).Value
CumSeq = 0
Coln = 2
End If
Loop While Cells(Lign, 1) <> ""
End Sub
Sub Entete_F2()
Sheets("Feuil2").Select
Cells(1, 1).Value = "Personne"
Cells(1, 2).Value = "Sequence"
Cells(1, 3).Value = "Temps"
Sheets("Feuil1").Select
End Sub |
Partager