TCD et pourcentages

Bonjour,

J'ai un petit problème.

J'ai un TCD conçu sur le nombre d'occurences de tel ou tel texte, sur une table de donnée.

De ce TCD, je souhaite calculer les pourcentage d'occurence de texte A sur le nombre de lignes de la table globale. Pour cela je manipule donc les différents sous totaux

J'ai voulu faire une macro (en enregistrant mes actions faites à la main), mais à chaque calcul, le Compagnon Office m'affirme que l'enregistrement est impossible, mais laisse le mode enregistrement activé et me laisse continuer.

Je continue tout de même et enregister ma macro sans d'avantage de soucis.

Lorsque je souhaite exécuter la macro. on m'annoonce un bug, je lance le débugage, et il s'obstine sur une ligne où, il me semble, j'ai juste mis des contours en traits noirs continus sur mes cellules. Et ce qui me choque c'est qu'il ne le fait que sur une ligne.

En pièce jointe, je laisse le résultat désiré (dans Other Computations)

https://www.excel-pratique.com/~files/doc2/Excel_pratique3.rar

Sub Macro1()
'
' Macro1 Macro
' Macro enregistrée le 08/10/2009 par ludogironde
'

'
    Range("B98:R98").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Range("B98:R98").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    Range("B98").Select
    ActiveCell.FormulaR1C1 = "Percentage anomally per module and module per defect"
    Range("B98").Select
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Range("C98").Select
    Range("E98").Select
    Range("F98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Introduction Module"",""Anomaly type"",""INS"")/RC[6]"
    Range("F98").Select
    Range("G98").Select
    Range("H98").Select
    Range("I98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Introduction Module"",""Anomaly type"",""REJ"")"
    Range("I98").Select
    Range("J98").Select
    Range("K98").Select
    Range("D98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Cash Module"")"
    Range("D98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Cash Module"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"")"
    Range("L98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Introduction Module"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2)"
    Range("M98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Recycling Module"",""Anomaly type"",""DRx"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2)"
    Range("N98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Recycling Module"",""Anomaly type"",""ESC"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2)"
    Range("O98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Recycling Module"",""Anomaly type"",""URM"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2)"
    Range("P98").Select
    ActiveCell.FormulaR1C1 = _
        "=GETPIVOTDATA(""Final Intervention quantity this week"",R84C2,""DefectFamily"",""Hardware Defect"",""Hardware module"",""Recycling Module"")/GETPIVOTDATA(""Final Intervention quantity this week"",R84C2)"
    Range("Q98").Select
    ActiveCell.FormulaR1C1 = ""
    Range("C98:P98").Select
    Range("P98").Activate
    Selection.NumberFormat = "0.0%"
End Sub
Sub Pourcentages()

End Sub

Bonjour,

J'ai un TCD conçu sur le nombre d'occurences de tel ou tel texte, sur une table de donnée.

Dans ton fichier, il y a plusieurs TCD. Du quel parles tu ?

J'ai voulu faire une macro (en enregistrant mes actions faites à la main),

Je vois ta macro avec la mise en forme, mais tu es sur quelle feuille ?

Comme dans ton premier fil, on ne voit pas trop le résultat et ce que tu veux faire.

A te relire

Dan

Rechercher des sujets similaires à "tcd pourcentages"