Array + sum if : correction de code
	
	
		Bonjour, 
Voici mon code qui me permet d'effectuer une sumif à partir d'une array(). Mon code rencontre un problème de poids. 
En effet, lorsque j'utilise Array() avec un loop For X= 1 to Ubound (Z) la fonction array () considère Ubound est considéré à 4. Conséquemment, j'ai une limite qui se situe entre 0 et 4 au lieu de 1 à 5. 
Comme puis-je corriger ce petit problème?   
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 
 | Sub calcul_sumif()
 
Dim I As Integer
Dim Caridal As String
Dim Count_nb, region as variant
 
count_nb = WorksheetFunction.CountA(Sheets("data").Range("a:a"))
Cardinal = Array("East", "North", "South", "West", "Central")
 
For I = 0 To UBound(Cardinal) ''''Mon problème ce trouve ici
    region = WorksheetFunction.SumIf(Range("b1: b" & count_nb), Range("f" & I).Value, Range("c1: c" & count_nb))
    Range("g" & I) = region '''' en effet, G0 n'existe pas sur une feuille excel => Erreur 
Next I
 
End Sub |