Formule matriciel Erreur d'exécution

Bonjour à toutes et à tous.

Je rencontre un problème lors de l'exécution d'un macro qui rempli un onglet donné avec des formules matricielles.

Cela fonctionne pour l'ensemble de ces formules sauf lorsque je cherche à additionner les valeurs de cellule de différents onglets.

Sheets("Recup").Activate
    Range("A5").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
    End With
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "Temps appel Support_3"
    Range("A6").Select
    Selection.NumberFormat = "[h]:mm:ss;@"
    Selection.FormulaArray = _
        "=SUM((Support_3!R2C2:R65535C2>=DATEVALUE(""" & Date_D & """))*(Support_3!R2C2:R65535C2<=DATEVALUE(""" & Date_F & """))*(Support_3!R2C3:R65535C3))" '<---- Ici cela fonctionne sans problème 

    Sheets("Recup").Activate
    Range("A7").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = 0.599993896298105
        .PatternTintAndShade = 0
    End With
    Range("A7").Select
    ActiveCell.FormulaR1C1 = "Temps appel Support_4 & 5"
    Range("A8").Select
    Selection.NumberFormat = "[h]:mm:ss;@"
    Selection.FormulaArray = _
        "=SUM((Support_4!R2C2:R65535C2>=DATEVALUE(""" & Date_D & """))*(Support_4!R2C2:R65535C2<=DATEVALUE(""" & Date_F & """))*(Support_4!R2C3:R65535C3)+(Support_5!R2C2:R65535C2>=DATEVALUE(""" & Date_D & """))*(Support_5!R2C2:R65535C2<=DATEVALUE(""" & Date_F & """))*(Support_5!R2C3:R65535C3))" '<----- Ici j'ai le message d'erreur ci-après    

En revanche si je tape la formule directement, cela fonctionne. Pour être sur, je me suis même enregistrer celle-ci pour la reproduire en mode macro mais rien n'y fait.

Merci pour votre aide.

Bon finalement, j'ai contourné le problème.

Visiblement la somme de matrice pose un souci lors d'exécution de macro.

J'ai donc variabiliser le résultat et ensuite additionner ceux-ci et ça marche impec !

Voici le code :

    Range("A8").Select
    Selection.NumberFormat = "[h]:mm:ss;@"
    Selection.FormulaArray = _
        "=SUM((Support_1!R2C2:R65535C2>=DATEVALUE(""" & Date_D & """))*(Support_1!R2C2:R65535C2<=DATEVALUE(""" & Date_F & """))*(Support_1!R2C3:R65535C3))"
    temps_appel_X = Selection.Value
    Selection.Value = ""
    Selection.FormulaArray = _
        "=SUM((Support_2!R2C2:R65535C2>=DATEVALUE(""" & Date_D & """))*(Support_2!R2C2:R65535C2<=DATEVALUE(""" & Date_F & """))*(Support_2!R2C3:R65535C3))"
    temps_appel_Y = Selection.Value
    Selection.Value = ""
    Selection.NumberFormat = "[h]:mm:ss;@"
    temps_appel_Z = temps_appel_X + temps_appel_Y
    Selection.Value = temps_appel_Z

Tadaaaaaaa !

En espérant que ça puisse servir à quelques autres. : D

Rechercher des sujets similaires à "formule matriciel erreur execution"