| 12
 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
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 
 |  
Sub matricule()
Dim NomEmployer(10) As String
Dim NumereauMatricule(10) As String
Dim K As String
Dim enplacementEmployer(10) 'je ne savais pas comment appeler la variable
 
NomEmployer(1) = "toto" ' nom employer et matricule qui corespond
NumereauMatricule(1) = 4127
NomEmployer(2) = "tata"
NumereauMatricule(2) = 4144
NomEmployer(3) = "tarzen"
NumereauMatricule(3) = 4145
NomEmployer(4) = "DD"
NumereauMatricule(4) = 4149
NomEmployer(5) = "moi"
NumereauMatricule(5) = 4158
NomEmployer(6) = "toi"
NumereauMatricule(6) = 4163
NomEmployer(7) = "lui"
NumereauMatricule(7) = 4164
NomEmployer(8) = "elle"
NumereauMatricule(8) = 4166
NomEmployer(9) = "autre"
NumereauMatricule(9) = 4169
 
EmployerTotal = 9 'nombre total d'employer
 
For i = 1 To EmployerTotal
On Error Resume Next 'créé les feuil feuil
   Sheets(NumereauMatricule(i)).Delete
   On Error GoTo 0
   Sheets.Add
   ActiveSheet.Name = NumereauMatricule(i)
   With ActiveWorkbook.Worksheets(NumereauMatricule(i))
        .Range("A1").Value = "Date"
        .Range("B1").Value = "entrée 1"
        .Range("C1").Value = "sortie 1"
        .Range("D1").Value = "entrée 2"
        .Range("E1").Value = "sortie 2"
        .Range("F1").Value = "Total"
        .Range("i1").Value = NumereauMatricule(i)
        .Range("i2").Value = NomEmployer(i)
    End With
Next i
 
 
 
 
j = 2
For i = 1 To EmployerTotal
enplacementEmployer(i) = 2
Next i
matriculePressedent = "0"
 
While ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 1).Value <> "" 'boucle tent qu'il y a des valeur, on ne sort pas de la boucle
    For i = 1 To EmployerTotal
        If ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 4).Value = NumereauMatricule(i) Then
            K = NumereauMatricule(i)
            M = i
        End If
    Next i
 
    If matriculePressedent = K And L = 3 Then
        L = 4
    Else
        ' tu peux placé le code ici
        ' ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M),1).Value = date
        L = 2
        enplacementEmployer(MPressedent) = enplacementEmployer(MPressedent) + 1
    End If
 
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), L).NumberFormatLocal = "hh:mm"
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), L).Value = ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 3).Value
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), 1).Value = ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 2).Value
    L = L + 1
    j = j + 1
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), L).NumberFormatLocal = "hh:mm"
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), L).Value = ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 3).Value
    ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(M), 1).Value = ActiveWorkbook.Worksheets("Pointeuse").Cells(j, 2).Value
    j = j + 1
    matriculePressedent = K
    MPressedent = M
 
Wend
End Sub | 
Partager