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
| Sub toto()
Dim cellule As Variant
Dim feuille As Variant
Dim chaine As Variant
Dim chaineFinale As Variant
Dim a As Integer 'compteur
Dim b As Integer 'compteur
Dim i As Integer
Sheets("resultat").Cells(1, 1).Value = ""
i = 1
j = 2
While Sheets("registre").Cells(i, 1).Value <> ""
chaine = Sheets("registre").Cells(i, 2).Value & Chr(10)
Sheets("resultat").Cells(1, 2).Value = chaine
Sheets("resultat").Cells(1, 1).Value = Sheets("resultat").Cells(1, 1).Value & Sheets("resultat").Cells(1, 2).Value
feuille = Sheets("registre").Cells(i, 1).Value
j = 2
While (Sheets(feuille).Cells(j, 1).Value) <> ""
If (Sheets(feuille).Cells(j, 1).Value = "aprevoir") Then chaine = "aprevoir" & Sheets(feuille).Cells(j, 2).Value & Chr(10)
If (Sheets(feuille).Cells(j, 1).Value = "encours") Then chaine = "encours" & Sheets(feuille).Cells(j, 2).Value & Chr(10)
If (Sheets(feuille).Cells(j, 1).Value = "bloque") Then chaine = "bloque" & Sheets(feuille).Cells(j, 2).Value & Chr(10)
If (Sheets(feuille).Cells(j, 1).Value = "clos") Then chaine = "clos" & Sheets(feuille).Cells(j, 2).Value & Chr(10)
Sheets("resultat").Cells(1, 2).Value = chaine
Sheets("resultat").Cells(1, 1).Value = Sheets("resultat").Cells(1, 1).Value & Sheets("resultat").Cells(1, 2).Value
j = j + 1
Wend
i = i + 1
Wend
End Sub |