khalid79m
05-20-2009, 02:00 AM
How do I write a macro to round corners on my graphs.
Private Sub Cons()
Dim LastRow As Long
With Sheets("CONS")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("CONS").Range("F1:J" & LastRow), PlotBy:= _
xlColumns
ActiveChart.SeriesCollection(1).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(2).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(3).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(4).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(5).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.Name = "AVC"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Data3"
With Charts("AVC")
.DrawingObjects.RoundedCorners = True
End With
End
Also how do I name the chart something other than Chart1 , Chart2 etc as everytime I write a macro , and run it the Chart number keeps rising , is there a way to name the chart for vba ? if that makes sense
Private Sub Cons()
Dim LastRow As Long
With Sheets("CONS")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("CONS").Range("F1:J" & LastRow), PlotBy:= _
xlColumns
ActiveChart.SeriesCollection(1).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(2).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(3).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(4).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.SeriesCollection(5).XValues = Sheets("CONS").Range("A2:A" & LastRow)
ActiveChart.Name = "AVC"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Data3"
With Charts("AVC")
.DrawingObjects.RoundedCorners = True
End With
End
Also how do I name the chart something other than Chart1 , Chart2 etc as everytime I write a macro , and run it the Chart number keeps rising , is there a way to name the chart for vba ? if that makes sense