+ Reply to Thread
Results 1 to 4 of 4

Formatting Multiple Series in a Chart

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Formatting Multiple Series in a Chart

    The following code changes each line series from 2.25 point to .75 point. It should also change the color of each line to a dark green but it doesn't. The chart stays multicolored unless I run it a second time. Why does it not change the line thickness and color all at the same time? I don't want to have to call this module twice to get it to do the job.

    Sub x()
        Dim objSeries As Series
        
        With ActiveChart
            For Each objSeries In .SeriesCollection
                With objSeries.Format.Line
                    .Transparency = 0
                    .Weight = 0.75
                    .ForeColor.RGB = RGB(40, 56, 24)
                End With
            Next
        End With
    End Sub

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formatting Multiple Series in a Chart

    I had the same experience on the first time through but when I changed the line back and ran the macro again, it changed both. It also changed both when I stepped through the function. I'm not sure what is going on.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Formatting Multiple Series in a Chart

    This change works for me,

    Sub x()
        Dim objSeries As Series
        
        With ActiveChart
            For Each objSeries In .SeriesCollection
                With objSeries.Format.Line
                    .Style = msoLineSingle
                    .Transparency = 0
                    .ForeColor.RGB = RGB(40, 56, 24)
                    .Weight = 0.75
                End With
            Next
        End With
    End Sub
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: Formatting Multiple Series in a Chart

    Excellent! Thank you very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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