I have the following code:
Set Chart1 = ActiveSheet.ChartObjects.Add _
(Left:=0, Width:=700, Top:=0, Height:=180)
Chart1.Chart.SetSourceData Source:=MC.Range(MC.Cells(1, 1), MC.Cells(255, iYears))
Chart1.Chart.ChartType = xlLine
Chart1.Activate
The problem is that each series is in a row but it seems to think that the series data are in columns. I know that manually I can right click the chart, select "Select Data" and click on the "Switch Row/Column" button to fix it but I can't figure out how to do this in code. The macro recorder was no help as it only gave me this when I ran through the sequence manually.
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+g
'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SetSourceData
End Sub
Any help would be appreciated!
Bookmarks