|
楼主 |
发表于 2020-11-28 09:30
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 ipaint 于 2020-11-28 10:16 编辑
- Sub test3_graph()
- Dim Sht2
-
- Dim pic As Shape
-
- '删除已创建图
- For Each pic In ActiveSheet.Shapes
- pic.Delete
- Next
-
-
- Set Sht2 = ThisWorkbook.Sheets("Sheet3")
-
- '创建新图
- With Sheets("Sheet3").Shapes.AddChart(xlLineMarkers, 0, 150, 550, 300).Chart
- .SetSourceData Source:=Range("Sheet3!$B$1:$L$4"), PlotBy:=xlColumns '设置数据源
- .Axes(xlValue).MinimumScale = 3.5
- .Axes(xlCategory).Select
- .FullSeriesCollection(1).XValues = "=Sheet2!$M$24:$M$26"
- .Axes(xlValue).MajorGridlines.Delete
- .SeriesCollection(1).Points(1).MarkerSize = 10
-
- .SeriesCollection(1).Points(1).DataLabel.Text = "AAA" '该处报错:
- .SeriesCollection(1).Points(1).DataLabel.Left = 80.745
- .SeriesCollection(1).Points(1).DataLabel.Top = 233.97
- .SeriesCollection(11).Points(2).MarkerSize = 10
- .SeriesCollection(11).Points(2).Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
- End With
- End Sub
复制代码 |
|