Results 1 to 4 of 4

Why does my trendline equation change?

Threaded View

  1. #3
    Registered User
    Join Date
    06-21-2014
    Location
    Wyoming, United States, Earth, Milky Way Galaxy
    MS-Off Ver
    2007
    Posts
    4

    Re: Why does my trendline equation change?

    Posting the workbook won't work, it's 2.8 megs, plus there is confidential data contained there in.

    Here is the code I use to generate the plot data and the trend lines. There is a routine above this code that searches about 200 columns of various depth looking for matches entered in a userform. The x and y data are stored in 2 strings, separated by commas. I have stepped through the code, and watched the chart as it's being generated. After the first series is created, the trend line is correct. After the 2nd series, the trend line changes to an altered equation. I have tried commenting out code to find out what is going on, but it has not yeilded anything.

        For iLooper = 0 To lbDate.ListCount - 1
            Application.StatusBar = " Generating Chart " & Int(((iLooper + 1) / (lbDate.ListCount)) * 100) & "% Complete"
            With ActiveChart.SeriesCollection.NewSeries
                If Not chkTrend Or lbDate.ListCount = 1 Then .Name = "=" + Chr(34) + lbDate.List(iLooper) + " Data" + Chr(34)
                .ChartType = xlXYScatter
                .Values = "={" + ArrAxisDataY(iLooper) + "}"
                .XValues = "={" + ArrAxisDataX(iLooper) + "}"
                If Not chkTrend Then
                    .MarkerSize = 3
                Else
                    .MarkerSize = 2
                End If
                .MarkerStyle = 8
            End With
            If chkTrend Then
                If lbDate.ListCount > 1 Then
                    For iCount = 1 To ActiveChart.SeriesCollection(iLooper + 1).Points.Count
                        With ActiveChart.SeriesCollection(iLooper + 1).Points(iCount)
                            .Format.Fill.Solid
                            .MarkerBackgroundColor = rgbColor(iLooper)
                            .MarkerForegroundColor = rgbColor(iLooper)
                        End With
                    Next iCount
                End If
                With ActiveChart.SeriesCollection(iLooper + 1).Trendlines.Add
                    .Type = xlLinear
                    .Name = "=" + Chr(34) + lbDate.List(iLooper) + " Trends" + Chr(34)
                    .Border.LineStyle = xlContinuous
                    .Border.Weight = xlThick
                    .Border.Color = rgbColor(iLooper)
                End With
            End If
        Next iLooper
    Last edited by AngryRat77; 11-29-2014 at 09:17 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 11-03-2014, 08:04 PM
  2. Replies: 3
    Last Post: 03-06-2011, 01:38 PM
  3. Replies: 1
    Last Post: 04-23-2009, 08:23 PM
  4. Trendline equation
    By safdarhassan in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-11-2007, 08:51 AM
  5. Trendline Equation- value of x?
    By bastien86 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-07-2006, 10:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1