Using Excel 2010 I am trying to create a chart on Sheet1 using partial data from several different tables. In the below example I am just trying to pull the data from one table as a start. I seem to be having difficulty setting the range of this data in this table.
I will eventually loop through about 8 data columns of various lengths per table with approx. 21 tables. So any help automating this would be great
This is what I have so far...
Sub createChart()
Dim rng As Range
Dim chrt As Object
'Table is named BMS_01_01_Module_01 and the column Name I want data from is Cell 1 Voltage
Set chrt = Sheet1.Shapes.AddChart2
chrt.ChartArea.SetSourceData Source:=activesheetlistobjects("BMS_01_01_Module_01").ListColumns("Cell 1 Voltage").Range
chrt.ChartArea.ChartType = x1Line
End Sub