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 153 154 155 156 157 158 159 160
| Option Explicit
Sub Main()
Dim borderline(50) As Integer
Dim criminel(50) As Integer
Dim justicier(50) As Integer
Dim habitant(50) As Integer
Dim countBor As Integer
Dim countCri As Integer
Dim countJus As Integer
Dim countHab As Integer
Dim i, j As Integer
countBor = 0
countCri = 0
countJus = 0
countHab = 0
For i = 3 To 300 Step 1
If Feuil1.Cells(2, i) = "Borderline" Then
borderline(countBor) = i
countBor = countBor + 1
ElseIf Feuil1.Cells(2, i) = "Criminel" Then
criminel(countCri) = i
countCri = countCri + 1
ElseIf Feuil1.Cells(2, i) = "Justicier" Then
justicier(countJus) = i
countJus = countJus + 1
ElseIf Feuil1.Cells(2, i) = "Habitant" Then
habitant(countHab) = i
countHab = countHab + 1
End If
Next
Dim topBor As Integer
Dim topBorLine As Integer
Dim topCri As Integer
Dim topCriLine As Integer
Dim topJus As Integer
Dim topJusLine As Integer
Dim topHab As Integer
Dim topHabLine As Integer
topBor = 0
topCri = 0
topJus = 0
topHab = 0
For i = 3 To 34 Step 1
For j = 1 To Range("AK12").Value
If Feuil1.Cells(i, borderline(j)) > topBor Then
topBor = Feuil1.Cells(i, j)
topBorLine = j
End If
Next
Feuil1.Cells(i, topBorLine).Font.FontStyle = "Gras"
Feuil1.Cells(i, topBorLine).Font.Color = RGB(87, 102, 84)
For j = 1 To Range("AK13").Value
If Feuil1.Cells(i, criminel(j)) > topCri Then
topCri = Feuil1.Cells(i, j)
topCriLine = j
End If
Next
Feuil1.Cells(i, topCriLine).Font.FontStyle = "Gras"
Feuil1.Cells(i, topCriLine).Font.Color = RGB(133, 8, 8)
For j = 1 To Range("AK15").Value
If Feuil1.Cells(i, justicier(j)) > topJus Then
topJus = Feuil1.Cells(i, j)
topJusLine = j
End If
Next
Feuil1.Cells(i, topJusLine).Font.FontStyle = "Gras"
Feuil1.Cells(i, topJusLine).Font.Color = RGB(126, 166, 154)
For j = 1 To Range("AK14").Value
If Feuil1.Cells(i, habitant(j)) > topHab Then
topHab = Feuil1.Cells(i, j)
topHabLine = j
End If
Next
Feuil1.Cells(i, topHabLine).Font.FontStyle = "Gras"
Feuil1.Cells(i, topHabLine).Font.Color = RGB(47, 91, 120)
topBor = 0
topCri = 0
topJus = 0
topHab = 0
Next
Dim totalBor As Integer
Dim topTotalBor As Integer
Dim topTotalBorLine As Integer
Dim totalCri As Integer
Dim topTotalCri As Integer
Dim topTotalCriLine As Integer
Dim totalJus As Integer
Dim topTotalJus As Integer
Dim topTotalJusLine As Integer
Dim totalHab As Integer
Dim topTotalHab As Integer
Dim topTotalHabLine As Integer
topTotalBor = 0
topTotalCri = 0
topTotalJus = 0
topTotalHab = 0
For j = 1 To Range("AK12").Value
If Feuil1.Cells(34, borderline(j)) > topTotalBor Then
topTotalBor = Feuil1.Cells(34, j)
topTotalBorLine = j
End If
totalBor = totalBor + Feuil1.Cells(34, j)
Next
Feuil1.Cells(37, 5) = totalBor
Feuil1.Cells(38, 5) = Feuil1.Cells(1, topTotalBorLine)
For j = 1 To Range("AK13").Value
If Feuil1.Cells(34, criminel(j)) > topTotalCri Then
topTotalCri = Feuil1.Cells(34, j)
topTotalCriLine = j
End If
totalCri = totalCri + Feuil1.Cells(34, j)
Next
Feuil1.Cells(37, 6) = totalCri
Feuil1.Cells(38, 6) = Feuil1.Cells(1, topTotalCriLine)
For j = 1 To Range("AK15").Value
If Feuil1.Cells(34, justicier(j)) > topTotalJus Then
topTotalJus = Feuil1.Cells(34, j)
topTotalJusLine = j
End If
totalJus = totalJus + Feuil1.Cells(34, j)
Next
Feuil1.Cells(37, 8) = totalJus
Feuil1.Cells(38, 8) = Feuil1.Cells(1, topTotalJusLine)
For j = 1 To Range("AK14").Value
If Feuil1.Cells(34, habitant(j)) > topTotalHab Then
topTotalHab = Feuil1.Cells(34, j)
topTotalHabLine = j
End If
totalHab = totalHab + Feuil1.Cells(34, j)
Next
Feuil1.Cells(37, 7) = totalHab
Feuil1.Cells(38, 7) = Feuil1.Cells(1, topTotalHabLine)
End Sub |
Partager