Apologies if this has been answered before, but I couldn't find a solution.
Attached file Three Col Graph.xlsm has Macro that SHOULD create a line graph from data in Cols C. E and G
The Macro in the file creates the graph using data in ONE Column, but I can't find how to set the values to cover all three columns.
Option Explicit
Sub CreateChart()
Dim ChartObj As ChartObject
Dim ChartSeries As Series
Sheet1.Activate
'DELELE ANY OLDER CHARTS IN THE SHEET
On Error Resume Next
ActiveSheet.ChartObjects("Month end Values").Delete
'CREATE NEW CHART
Set ChartObj = ActiveSheet.ChartObjects.Add(Left:=805, Width:=600, Top:=100, Height:=270)
ChartObj.Chart.ChartType = xlLine
ChartObj.Name = "Month end Values"
Set ChartSeries = ChartObj.Chart.SeriesCollection.NewSeries
With ChartSeries
.Name = "Month End Values"
'The Values line is the problem. It SHOULD use the three columns C, E and G
'I tried ".values= Range("C4:C50,E4:E50,G4:G50")" AND "ActiveChart.SetSourceData Source:=Range("Sheet1!$C$4:$C$50,Sheet1!$E$4:$E$50,Sheet1!$G$4:$G$50")" Neither worked.
.Values = Range("C4:C50")
ActiveSheet.ChartObjects("Month end Values").Activate
ActiveSheet.ChartObjects("Month end Values").Activate
ActiveChart.Legend.Select
Selection.Delete
End With
End Sub
Any suggestions received gratefully
Ochimus
Bookmarks