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 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
Sub matricule()
Dim NomEmployer(29) As String
Dim NumereauMatricule(29) As String
Dim K As String
Dim enplacementEmployer(29) 'je ne savais pas comment appeler la variable
NomEmployer(11) = "TOTO" ' nom employer et matricule correspondant
NumereauMatricule(11) = 4127
NomEmployer(12) = "TATA"
NumereauMatricule(12) = 4164
NomEmployer(13) = "TITI"
NumereauMatricule(13) = 4145
NomEmployer(14) = "ROMINET"
NumereauMatricule(14) = 4149
NomEmployer(15) = "CALC"
NumereauMatricule(15) = 4158
NomEmployer(16) = "DARK"
NumereauMatricule(16) = 4163
NomEmployer(17) = "VADOR"
NumereauMatricule(17) = 4171
NomEmployer(18) = "DARKE"
NumereauMatricule(18) = 4146
NomEmployer(19) = "SIDIOUS"
NumereauMatricule(19) = 4169
NomEmployer(20) = "AFIN"
NumereauMatricule(20) = 4173
NomEmployer(21) = "DE"
NumereauMatricule(21) = 4166
NomEmployer(22) = "FAIRE"
NumereauMatricule(22) = 1
NomEmployer(23) = "UN"
NumereauMatricule(23) = 4069
NomEmployer(24) = "EXEMPLE"
NumereauMatricule(24) = 4037
NomEmployer(25) = "EN"
NumereauMatricule(25) = 1247
NomEmployer(26) = "LISANT"
NumereauMatricule(26) = 4157
NomEmployer(27) = "CELA"
NumereauMatricule(27) = 4150
NomEmployer(28) = "SOYEZ"
NumereauMatricule(28) = 4128
EmployerTotal = 28 'nombre total d'employer
For i = 11 To EmployerTotal
On Error Resume Next 'création des 18 feuilles par rapport à employertotal, pour un employé une feuille de créer
Sheets(NumereauMatricule(i)).Delete
On Error GoTo 0
Sheets.Add
ActiveSheet.Name = NumereauMatricule(i) 'on correspond au nom de la page ,le matricule de l'employé
With ActiveWorkbook.Worksheets(NumereauMatricule(i))
Columns("A:A").Select
Selection.NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
Columns("G:G").ColumnWidth = 14.29
Columns("A:A").ColumnWidth = 22.86
.Range("A11").Value = "Date"
.Range("B11").Value = "entrée 1"
.Range("C11").Value = "sortie 1"
.Range("D11").Value = "entrée 2"
.Range("E11").Value = "sortie 2"
.Range("F11").Value = "Total/jour"
.Range("G11").Value = "Total/semaine"
Columns("I:I").ColumnWidth = 15.29
.Range("A1").Value = "DEVINE"
.Range("A3").Value = "LA RUE"
.Range("A5").Value = "OU"
.Range("A7").Value = NomEmployer(i)
.Range("F7").Value = "numéro de carte : " & NumereauMatricule(i)
.Range("F5").Value = "LA VILLE"
.Range("A11:G37").Select
.Range("A37").Value = "Total du mois"
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
End With
Next i 'on passe au rang suivant
Dim j As Integer
Dim l As Integer
j = 12
For i = 10 To EmployerTotal
enplacementEmployer(i) = 12
Next i
matriculePressedent = "0"
While ActiveWorkbook.Worksheets("Feuil1").Cells(j, 1).Value <> "" 'tant qu'il existe une valeur dans la colonne A la boucle continue
For i = 10 To EmployerTotal
If ActiveWorkbook.Worksheets("Feuil1").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
l = 2
enplacementEmployer(MPressedent) = enplacementEmployer(MPressedent) + 1
End If
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), l).NumberFormatLocal = "hh:mm:ss"
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), l).Value = ActiveWorkbook.Worksheets("Feuil1").Cells(j, 3).Value 'on copie les cellules de la pointeuse vers la nouvelle
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), 1).Value = ActiveWorkbook.Worksheets("Feuil1").Cells(j, 2).Value
l = l + 1
j = j + 1
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), l).NumberFormatLocal = "hh:mm:ss"
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), l).Value = ActiveWorkbook.Worksheets("Feuil1").Cells(j, 3).Value
ActiveWorkbook.Worksheets(K).Cells(enplacementEmployer(m), 1).Value = ActiveWorkbook.Worksheets("Feuil1").Cells(j, 2).Value
j = j + 1
matriculePressedent = K
MPressedent = m
Wend
End Sub |
Partager