sti*_*tim 5 microsoft-excel-2007 charts microsoft-excel microsoft-excel-2010
在 OpenOffice 中,我通过 RightClick 获取趋势线和平均线属性。但在 Excel 2007 中,我只看到趋势线。与 Excel 2010 相同。如何在 Excel 中制作平均线?
顺便说一句,我有想要的宏:
Sub averageline()
' Adds line of average value for the selected series
Dim s As Series, v, m As Double, v1, i As Long
On Error GoTo err_selection
Set s = Selection
On Error GoTo 0
v = s.Values
m = WorksheetFunction.Average(v)
v1 = v
For i = LBound(v) To UBound(v)
v1(i) = m
Next
With ActiveChart.SeriesCollection.NewSeries
.XValues = s.XValues
.Values = v1
.Name = "Average " & s.Name
.AxisGroup = s.AxisGroup
.MarkerStyle = xlNone
.Border.Color = s.Border.Color
End With
Exit Sub
err_selection:
MsgBox "Selection don't represent series on the chart", vbCritical
Exit Sub
End Sub
Run Code Online (Sandbox Code Playgroud)
添加后,您只需选择图表上的任何行,然后按 alt+f8,选择宏并输入。
归档时间: |
|
查看次数: |
83586 次 |
最近记录: |