[VBA-EXCEL ][DONE]Mise en forme d'un graphique à taille variable

Mise en forme d'un graphique à taille variable [VBA-EXCEL ][DONE] - VB/VBA/VBS - Programmation

Marsh Posté le 15-11-2005 à 16:18:18    

bonjour,
 
j'ai un petit souci je voudrais faire auto dimensionner mon tableau
 
voici mon code  
 
http://img285.imageshack.us/img285/833/sanstitre27ov.th.jpg
 

Code :
  1. Sub CreaGraphiq()
  2. Charts.Add
  3.     ActiveChart.ChartType = xlColumnClustered
  4.     ActiveChart.SeriesCollection(1).Delete
  5.    
  6.     Dim i
  7.     For i = 3 To Worksheets.Count + 1
  8.     With ActiveChart.SeriesCollection.NewSeries
  9.         .Name = Sheets(i).Name
  10.         .Values = "='" & Sheets(i).Name & "'!R30C6"
  11.    
  12.     End With
  13.     Next i
  14.     With ActiveChart
  15.         .HasTitle = True
  16.         .ChartTitle.Characters.Text = "Récapitulatif des chantiers ( Totaux généraux HT )"
  17.         .Axes(xlCategory, xlPrimary).HasTitle = False
  18.         .Axes(xlValue, xlPrimary).HasTitle = False
  19.         .HasLegend = True
  20.         .Legend.Select
  21.             Selection.Position = xlTop
  22.             Selection.Left = 57
  23.             Selection.Width = 469
  24.             Selection.Width = 514
  25.             Selection.Height = 82
  26.     End With
  27.    
  28.    
  29.    
  30.    
  31.     ActiveChart.SeriesCollection(1).Delete
  32.     ActiveChart.Export Filename:="Graphique.png", FilterName:="png"
  33.     ActiveChart.Location Where:=xlLocationAsObject, Name:="Total"
  34.  
  35. End Sub


 
et je voudrais plus ça  
 
http://img359.imageshack.us/img359/7644/sanstitre22ao.th.jpg


Message édité par sakuraba le 15-11-2005 à 16:35:24
Reply

Marsh Posté le 15-11-2005 à 16:18:18   

Reply

Marsh Posté le 15-11-2005 à 16:35:00    

le probleme est reglé en faisant ça  
 

Code :
  1. Sub CreaGraphiq()
  2. Charts.Add
  3.     ActiveChart.ChartType = xlColumnClustered
  4.     ActiveChart.SeriesCollection(1).Delete
  5.    
  6.     Dim i
  7.     For i = 3 To Worksheets.Count + 1
  8.     With ActiveChart.SeriesCollection.NewSeries
  9.         .Name = Sheets(i).Name
  10.         .Values = "='" & Sheets(i).Name & "'!R30C6"
  11.     End With
  12.     Next i
  13.     With ActiveChart
  14.         .HasTitle = True
  15.         .ChartTitle.Characters.Text = "Récapitulatif des chantiers ( Totaux généraux HT )"
  16.         .Axes(xlCategory, xlPrimary).HasTitle = False
  17.         .Axes(xlValue, xlPrimary).HasTitle = False
  18.         .HasLegend = True
  19.         .Legend.Select
  20.             Selection.Position = xlTop
  21.     End With
  22.     ActiveChart.SeriesCollection(1).Delete
  23.     ActiveChart.Export Filename:="Graphique.png", FilterName:="png"
  24.     ActiveChart.Location Where:=xlLocationAsObject, Name:="Total"
  25.  
  26. End Sub

Reply

Marsh Posté le 15-11-2005 à 16:36:56    

http://img285.imageshack.us/img285/833/sanstitre27ov.th.jpg
 
par contre j'ai toujours ce chiffre 1 qui se balade pres de la colonne rose :?

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed