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
| Sub Bouton1_Clic()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim Cmpt As Integer
Dim Cmptgeo As Integer
Dim StrBuf As String
Dim StrBufbis As String
Dim Addstage As Integer
Dim AddGeo As Integer
Dim Cmptter As Integer
i = 2
j = 2
'boucle qui me permet de connaitre le nombre de sociétés avec tous les critères ensuite par colonne
Worksheets("Rtest").Activate
Do While Cells(i, 1).Value <> ""
i = i + 1
Loop
Worksheets("Stats").Activate
Cells(3, 4).Value = i - 1
'Boucle qui me permet de voir tant que j ai pas atteind la derniere boite de voir si le critère (géographioque par exemple) a deja été ajouté dans les stats géo et si non (cf AddGeo = 1 ou 0) je compte combien de fois je le trouve dans la colonne
Do While j < i
AddGeo = 1
Addstage = 1
Cmpt = 0
Cmptgeo = 0
k = 5
m = 5
Worksheets("Rtest").Activate
StrBuf = Cells(j, 2).Value
StrBufbis = Cells(j, 6).Value
Worksheets("Stats").Activate
Do While (Cells(k, 3).Value <> "" And Addstage = 1)
If StrBuf = Cells(k, 3).Value Then
Addstage = 0
End If
k = k + 1
Loop
Do While (Cells(m, 10).Value <> "" And AddGeo = 1)
If StrBufbis = Cells(m, 10).Value Then
AddGeo = 0
End If
m = m + 1
Loop
If Addstage = 1 Then
Worksheets("Rtest").Activate
For l = 2 To i
If Cells(l, 2).Value = StrBuf Then
Cmpt = Cmpt + 1
End If
Next
Worksheets("Stats").Activate
Cells(k, 3).Value = StrBuf
Cells(k, 4).Value = Cmpt
End If
If AddGeo = 1 Then
Worksheets("Rtest").Activate
For l = 2 To i
If Cells(l, 6).Value = StrBufbis Then
Cmptgeo = Cmptgeo + 1
End If
Next
Worksheets("Stats").Activate
Cells(m, 10).Value = StrBufbis
Cells(m, 11).Value = Cmptgeo
End If
j = j + 1
Loop
Cmpt = 0
Cmptbis = 0
Cmptter = 0
Worksheets("Rtest").Activate
'Autre boucle pour voir les sociétés hors critères.
For l = 1 To i
If Cells(l, 4) = "Out" Then
Cmpt = Cmpt + 1
End If
If Cells(l, 3) = "Out" Then
Cmptbis = Cmptbis + 1
End If
If Cells(l, 5) = "Out" Then
Cmptter = Cmptter + 1
End If
Next
Worksheets("Stats").Activate
Cells(22, 4) = Cmpt
Cells(22, 8) = Cmptbis
Cells(22, 6) = Cmptter
End Sub |
Partager