Comment mettre un graphique à côté d'un autre et de la même taille

anthooooony

XLDnaute Occasionnel
Bonjour à tous!

J'ai une problematique de mise en page Excel. J'ai recupéré des codes et bidouillé de mon côté pour que mon graphique disons le 1, soit toujours à 5 lignes en dessous du mon tableau croisé dynamique. En effet ce dernier evolue en fonction des jours, si on bout de 10 jours je ne fais rien, le graphique se trouverait sur les données du tcd.
Donc ca marche, vous trouverez le code juste en dessous et le fichier joint pour ceux a qui ça pourrait interesser.


J'ai deux tableaux croisé cote à cote, ma macro s applique à un graphique.
Le problème étant que je souhaiterais que mon graphique 2, n'est pas de la même taille que le premier.

je voulais savoir s'il est possible que le deuxieme graphique s'ajuste en fonction du premier meme ligne meme taille?

Si mon tcd a 10 ligne de + le graphique 1 bouge de 10 ligne +5 et le deuxieme en le "groupant" pourrait bouger?
En faite je ne sais pas du tout comment faire...


merci d avance si vous avez une petite piste pour m'orienter :

Anthoooony
Code:
Private Sub Workbook_Open()
If Environ("COMPUTERNAME") = "TCSSTF275" Then
If MsgBox("Attention la macro va partir", vbYesNo) = vbYes Then
  sousRépertoire = "Fichiers Tma Share"
  [A2].CurrentRegion.Offset(1, 0).Clear
  Set maitre = ActiveWorkbook
  Repertoire = ThisWorkbook.Path
  nf = Dir(Repertoire & "\" & sousRépertoire & "\*.xls") ' premier fichier
  Do While nf <> ""
    Workbooks.Open Filename:=Repertoire & "\" & sousRépertoire & "\" & nf
    n = [A1].CurrentRegion.Rows.Count - 1
    [A1].CurrentRegion.Offset(1, 0).Copy _
    maitre.Sheets(1).[A65000].End(xlUp).Offset(1, 0)

   
    ActiveWorkbook.Close False
    '-- nom onglet
   ' [A1].End(xlDown).End(xlToRight).Offset(-n + 1, 1).Resize(n, 1) = Left(nf, Len(nf) - 4)
    nf = Dir ' fichier suivant
      ActiveWorkbook.RefreshAll

  Loop
  Application.DisplayAlerts = False
      ActiveWorkbook.Worksheets("Feuil1").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Feuil1").AutoFilter.Sort.SortFields.Add Key:=Range _
        ("A1:A271"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Feuil1").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
        ActiveWorkbook.RefreshAll 'enregistrement de tout les tcd
    Range("A1").Select
    Sheets("Comparatifs CSP").Select
    Range("A1").Select
    
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlUp).Select
  ' ActiveCell.Offset(5, 0)
    
    
        
    ActiveSheet.ChartObjects("Graphique 3").Left = ActiveCell.Offset(5, 0).Range("A1").Left
    ActiveSheet.ChartObjects("Graphique 3").Top = ActiveCell.Offset(5, 0).Range("A1").Top
    ActiveSheet.ChartObjects("Graphique 3").Width = Range("A:E").Width
    
     Range("F1").Select
    
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlUp).Select
    
    ActiveSheet.ChartObjects("Graphique 6").Left = ActiveCell.Offset(5, 0).Range("A1").Left
    ActiveSheet.ChartObjects("Graphique 6").Top = ActiveCell.Offset(5, 0).Range("A1").Top
    ActiveSheet.ChartObjects("Graphique 6").Width = Range("F:K").Width
    
    
    Sheets("Csp Rouen").Select
    Range("A1").Select
        Range("A1").Select
    Sheets("Csp Rouen").Select
    Range("A1").Select
    
       Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlUp).Select
  ' ActiveCell.Offset(5, 0)
    
    
        
    ActiveSheet.ChartObjects("Graphique 4").Left = ActiveCell.Offset(5, 0).Range("A1").Left
    ActiveSheet.ChartObjects("Graphique 4").Top = ActiveCell.Offset(5, 0).Range("A1").Top
    ActiveSheet.ChartObjects("Graphique 4").Width = Range("A:G").Width
    
    Sheets("Csp Dieppe").Select
    Range("A1").Select
           Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlDown).Select
   Selection.End(xlUp).Select
  ' ActiveCell.Offset(5, 0)
    
    
        
    ActiveSheet.ChartObjects("Graphique 2").Left = ActiveCell.Offset(5, 0).Range("A1").Left
    ActiveSheet.ChartObjects("Graphique 2").Top = ActiveCell.Offset(5, 0).Range("A1").Top
    ActiveSheet.ChartObjects("Graphique 2").Width = Range("A:G").Width
    
    Sheets("Feuil2").Select
    Range("A1").Select
    
    
    Sheets("Feuil1").Select
    Range("A1").Select

      ActiveWorkbook.Save
' MAIL AGENCE ALSACE 1
 Dim OutApp As Object
    Dim OutMail As Object


    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    With OutMail
        .To = "anthooooony@hotmail.com"
  
        .Subject = "Test"
          '     .HTMLBody = "<font face='Calibri'>Bonjour,<br><br>Veuillez trouver ci-joint les indicateurs liés aux litiges clients déclarés sur votre agence.<br><br> On appelle <b><u>Litige</u></b>, toute information en provenance de clients ou d'agences suspendant les actions de relance vers le client sur les pièces contestées. <br>" & _
        "Rapport de la TMA :<br><br>" & _

        .Attachments.Add ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
        .Send   'or use .Display
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
    

  Application.DisplayAlerts = True
    End If
    End If

End Sub
 

Pièces jointes

  • demande exceldownload.xlsm
    83.4 KB · Affichages: 34

ERIC S

XLDnaute Barbatruc
Re : Comment mettre un graphique à côté d'un autre et de la même taille

Bonjour

j en'ai pas pris l etemps de regarder l ecode (on est vendredi soir...........)

ce que j'ai fait récemment :

graphique(s) positionné 30 lignes en dessous
aux actualisations du tcd, macro masque les lignes vides entre fin de tcd et graphique
tu ne gères donc que le masquage de lignes
 

Discussions similaires

  • Question
Microsoft 365 Code VBA
Réponses
2
Affichages
308

Membres actuellement en ligne

Statistiques des forums

Discussions
312 069
Messages
2 085 037
Membres
102 762
dernier inscrit
Ucef