|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub lqxs()
- Dim Arr, ks, js, nm1$, nm2$, dz1$, dz2$
- Dim dz$, dz3$, yy$, nm$
- Application.ScreenUpdating = False
- Sheet3.Activate
- Arr = [a1].CurrentRegion
- ks = 3: js = UBound(Arr) - 1
- nm = Sheet3.Name
- yy = Left(nm, Len(nm) - 3)
- nm1 = "图表 6"
- nm2 = "图表 4"
- dz = "A2:B" & js & ",D2:E" & js
- ActiveSheet.ChartObjects(nm1).Activate
- With ActiveChart
- .SetSourceData Source:=Sheets(nm).Range(dz), PlotBy:=xlColumns
- .SeriesCollection(1).Select
- dz1 = "R3C2:R" & js & "C2"
- .SeriesCollection(1).Values = "='" & nm & "'!" & dz1
- dz2 = "R3C4:R" & js & "C4"
- .SeriesCollection(2).Values = "='" & nm & "'!" & dz2
- dz3 = "R3C5:R" & js & "C5"
- .SeriesCollection(3).Values = "='" & nm & "'!" & dz3
- .ChartTitle.Select
- Selection.Characters.Text = yy & "月份合格率"
- End With
- ActiveSheet.ChartObjects(nm2).Activate
- With ActiveChart
- .ChartArea.Select
- dz = "H2:T2,H" & js + 1 & ":T" & js + 1
- .SetSourceData Source:=Sheets(nm).Range(dz), PlotBy:= _
- xlRows
- dz2 = "R" & js + 1 & "C8:R" & js + 1 & "C20"
- .SeriesCollection(1).Values = "='" & nm & "'!" & dz2
- .ChartTitle.Select
- Selection.Characters.Text = yy & "月份不良趋势统计"
- End With
- Range("A" & ks).Select
- Application.ScreenUpdating = True
- MsgBox "OK"
- End Sub
复制代码 |
|