ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Smoothing a chart line using VBA (https://www.excelbanter.com/excel-programming/330557-smoothing-chart-line-using-vba.html)

lewscannon

Smoothing a chart line using VBA
 
I have a macro that creates a Line Column on 2 Axes Chart and holds 3 sets of
data, the first 2 represented by columns, the third by a line. I have been
unsuccessfully trying to get the line to smooth between data points.

I have tried code such as:

With ActiveChart.LineGroups(1)
.Smooth = True
End With

Which gives me the error: "Object doesn't support this property or method"

or:

Dim Ser As Series
Set Ser = Charts("Attendance Roster Chart").SeriesCollection("Attendance
Pivot")
With Ser
.Smooth = True
.Border.Weight = xlThick
End With

(The chart name sheet is "Attendance Roster Chart", and the series is
"Attendance Pivot")

Which gives me the error message "Unable to get the SeriesCollection
property of the chart class"

I'm getting frustrated. Any ideas?

Thanks in advance


Jim Thomlinson[_4_]

Smoothing a chart line using VBA
 
Just to clarify, are you tring to do a polynomial regression of your source
data or to add a trend line, or to create a moving average, or just to change
the chart type to smooth line? Other than changing the chart type you have to
select a smoothing algrythm. I recommend looking at the trend function. I
have used it with quite a bit of success. If it is just a chart type issue
then just recording a macro of changing the chart type and analyzing what is
recorded should cover things.
--
HTH...

Jim Thomlinson


"lewscannon" wrote:

I have a macro that creates a Line Column on 2 Axes Chart and holds 3 sets of
data, the first 2 represented by columns, the third by a line. I have been
unsuccessfully trying to get the line to smooth between data points.

I have tried code such as:

With ActiveChart.LineGroups(1)
.Smooth = True
End With

Which gives me the error: "Object doesn't support this property or method"

or:

Dim Ser As Series
Set Ser = Charts("Attendance Roster Chart").SeriesCollection("Attendance
Pivot")
With Ser
.Smooth = True
.Border.Weight = xlThick
End With

(The chart name sheet is "Attendance Roster Chart", and the series is
"Attendance Pivot")

Which gives me the error message "Unable to get the SeriesCollection
property of the chart class"

I'm getting frustrated. Any ideas?

Thanks in advance



All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com