作者way12321 (???)
看板Office
标题[算表] VBA作图效能
时间Wed Jan 11 22:37:39 2017
软体: MS Excel
版本: 2010
有多笔资料需要靠回圈作图(原始页面)
但资料数据横向数值栏位较多时
产生的散布图资料范围自动判读为许多数列,再用回圈删除数列导致效能有点低落
(最後仅保留一个数列)
跑几十个图就花了数分钟,以下附上VBA内的段落
希望能请各位前辈帮忙改善或是告知是否有方法可以在加入图表时预设资料范围空白
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = ""
ActiveChart.SeriesCollection(1).XValues = "='" &
SheetName & "'!R2" &_
_"C" &
XAxis & ":R" &
DataEnd & "C" &
XAxis
ActiveChart.SeriesCollection(1).Values = "='" &
SheetName & "'!R2" &_
_"C" &
YAxisBegin + (
n - 1) *
UserForm1.TextBox2a6.Text & ":R" &_
_
DataEnd & "C" &
YAxisBegin + (
n - 1) *
UserForm1.TextBox2a6.Text
ActiveChart.Location Where:=xlLocationAsObject, Name:=SheetName
For
i = ActiveChart.SeriesCollection.Count To 2 Step -1
ActiveChart.SeriesCollection(
i).Delete
Next
'黄色部分为自己定义的变数仅供参考
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.224.41.213
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Office/M.1484145462.A.C4A.html
※ 编辑: way12321 (36.224.41.213), 01/11/2017 22:45:09