使用 Excel 2010 我正在尝试使用来自几个不同表的部分数据在 Sheet1 上创建一个图表。在下面的示例中,我只是尝试从一个表中提取数据作为开始。我似乎很难在此表中设置此数据的范围。
我最终将遍历每个表大约 8 个不同长度的数据列,大约 21张桌子。所以任何自动化的帮助都会很棒
这是我目前所拥有的......
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