Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 3455|回复: 1

【求助】vba代码含义,插入图表的代码

[复制链接]
发表于 2013-4-27 10:03 | 显示全部楼层 |阅读模式
5学分
【求助】:各位vba高手们,我想在工作表中插入我想要的图表。因为我要做的图表太多,工作量很大,所以我急需一个能在工作表中插入图表的VBA。现在我录制了一段VBA代码,但是里面的代码是什么意思,我完全不知道,请各位高手们能帮我讲解一下代码的含义了。十分感激你们的帮助了!!!!
  1. Sub Macro4()
  2. Charts.Add
  3. ActiveChart.ChartType = xlLineMarkers
  4. ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C42")
  5. ActiveChart.SeriesCollection.NewSeries
  6. ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R3C1:R17C1"
  7. ActiveChart.SeriesCollection(1).Values = "=Sheet1!R3C8:R17C8"
  8. ActiveChart.SeriesCollection(1).Name = "=""百米钻孔流量"""
  9. ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
  10. With ActiveChart
  11. .HasTitle = True
  12. .ChartTitle.Characters.Text = "下抽巷百米钻孔流量"
  13. .Axes(xlCategory, xlPrimary).HasTitle = True
  14. .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "时间"
  15. .Axes(xlValue, xlPrimary).HasTitle = True
  16. .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "百米钻孔流量值"
  17. End With
  18. Windows("123456.xls").SmallScroll Down:=3
  19. ActiveSheet.Shapes("图表 3").IncrementLeft -204.75
  20. ActiveSheet.Shapes("图表 3").IncrementTop 273#
  21. Windows("123456.xls").SmallScroll Down:=12
  22. ActiveSheet.Shapes("图表 3").ScaleWidth 1.33, msoFalse, msoScaleFromTopLeft
  23. ActiveSheet.Shapes("图表 3").ScaleHeight 1.07, msoFalse, msoScaleFromTopLeft
  24. ActiveWindow.Visible = False
  25. Windows("123456.xls").Activate
  26. Range("F43").Select
  27. Application.CommandBars("Stop Recording").Visible = False
  28. End Sub
复制代码

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
 楼主| 发表于 2013-4-27 10:06 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-2 13:47 , Processed in 0.323329 second(s), 6 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表