Discussion: Re macro pour graphe
Afficher un message
Vieux 14/10/2004, 10h46   #2 (permalink)
albert
 
Messages: n/a
Par défaut Re: Re macro pour graphe

bonjour clebad!,
je te propose un graphe en 2 dimensions

en x = Dim de la planche
en y = Prix(par planche)

voici la macro
Sub Macro1()
Sheets("Feuil1").Select
'----suppression du graphe-----------
ActiveSheet.ChartObjects(1).Delete
'---construction nouveau graphe
Range("A5").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A5:A20,C5").Select
Range("C5").Activate
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A5:A20,C5:C20"), _
PlotBy:=xlColumns
'---------axe x vertical-----------
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
ActiveChart.Axes(xlCategory).Select
With Selection.TickLabels
.Alignment = xlCenter
.Offset = 100
.Orientation = xlUpward
End With
'-----------dimension de chaque barre---------
With ActiveChart.Axes(xlCategory)
.CrossesAt = 1
.TickLabelSpacing = 1
.TickMarkSpacing = 1
.AxisBetweenCategories = True
.ReversePlotOrder = False
End With
Range("A4").Select
End Sub

albert
Fichiers attachés
Type de fichier : zip tabplanches1.zip (11,0 Ko, 0 affichages)