Chart.SetSourceData Source:=Range(RChart.Offset(-2, 0), RChart.Offset(-1, (CNum - 1))) 类似 绘图函数的
SourceData 为什么不能是自定义的数组 或者 Dim AllElements As Variant
还有数据透视表的函数里ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ 这里的SourceData 也必须是Range 不能是上述 自定义的数组 或者 Dim AllElements As Variant高手来指点下
SourceData 为什么不能是自定义的数组 或者 Dim AllElements As Variant
还有数据透视表的函数里ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ 这里的SourceData 也必须是Range 不能是上述 自定义的数组 或者 Dim AllElements As Variant高手来指点下
如果你要用变量,如果变量(变量类型是Range或Variant)的“值”是符合要求的Range对象,应该是可以的吧!
如果参数值是简单的数组,肯定就不行了。
Sub SetSourceData(Source As Range, [PlotBy])
参数 Source 的类型就是 Range 啊!清清楚楚的有什么问题!
版主 代码如下 Range("A1").Value = 10
Range("B1").Value = 4
Range("C1").Value = 5
Set RChart = Range("H5")
ActiveSheet.Shapes.AddChart(xlPie, (RChart.Left + RChart.Width / 2), RChart.Top, (RChart.Width * 3), (RChart.Height * 10)).Select
ActiveChart.SetSourceData Source:=Range("$A$1:$C$1") //问题就在这里 我必须事先设定 这三个Range的值 见前面的代码 貌似 这里的参数必须是range 其实 只需要一个三个 成员的integer 数组 就可以 有无其他方式 直接使用值(10,4,5)传入 这个绘图函数,而不必折腾 三个range出来
ActiveChart.SeriesCollection(1).XValues = "={""初级"",""中级"",""高级""}"
ActiveChart.SeriesCollection(1).Name = "=""人员能力分布"""
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.NameComplexScript = "微软雅黑"
ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.NameFarEast = "微软雅黑"
ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.Name = "微软雅黑"
ActiveChart.ChartTitle.Format.TextFrame2.TextRange.Font.Size = 10
如果没有填充好的Cell,假使支持其它比如数组之类的数据源;那么保存文件,下次再打开,画图表的时候该到哪里取数?