24小时热门版块排行榜    

查看: 1130  |  回复: 0

wlznxmc

木虫 (初入文坛)

[求助] vba用循环语句编程,绘图

CODE:
Sub 宏1()
'
' 宏1 宏
'

'

ActiveSheet.ChartObjects("图表 1").Activate

    ActiveChart.ChartArea.Copy
    Cells(5, n).Select
    ActiveSheet.Paste
    ActiveSheet.ChartObjects("图表 50").Activate
    ActiveChart.ChartTitle.Select
    Selection.Caption = "=顺河向绘图!$D$1"
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(2).Name = "=顺河向绘图!$D$2"
    ActiveChart.SeriesCollection(2).Values = "=顺河向绘图!$D$3:$D$1828"
   
End Sub
就是excel的列,依次从D到AH选择数据
我希望能实现第一幅图为  
Selection.Caption = "=顺河向绘图!$D$1"
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(2).Name = "=顺河向绘图!$D$2"
    ActiveChart.SeriesCollection(2).Values = "=顺河向绘图!$D$3:$D$1828"
第二幅图  
Selection.Caption = "=顺河向绘图!$E$1"
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(2).Name = "=顺河向绘图!$E$2"
    ActiveChart.SeriesCollection(2).Values = "=顺河向绘图!$E$3:$E$1828"
……
一直到
Selection.Caption = "=顺河向绘图!$AH$1"
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(2).Name = "=顺河向绘图!$AH$2"
    ActiveChart.SeriesCollection(2).Values = "=顺河向绘图!$AH$3:$AH$1828"

[ Last edited by jjdg on 2014-7-21 at 02:28 ]
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 wlznxmc 的主题更新
信息提示
请填处理意见