Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    SeriesCollection fail (Excel 2000)

    Hi all,

    I have charts within an Excel worksheet that I am trying to change the seriescollection so that each series in each chart is visible, and also change the font. I keep getting a selection fail 1004 series class fail.

    If someone has the time, could you please help me with this, I would like to work thru it myself , so that I can understand it - A HINT WOULD BE GREAT.

    Thanks,
    Darryl.

    Public Sub formatdataseries()
    Dim x As Integer
    Dim cht As ChartObject
    For Each cht In Sheets("CHARTSDAYSOFWEEK").ChartObjects
    Do Until x = 4
    Worksheets("CHARTSDAYSOFWEEK").ChartObjects(x).Cha rt. _
    SeriesCollection(x).Select
    With Selection.Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 9
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = xlAutomatic
    .Background = xlAutomatic
    End With
    Loop
    Next
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SeriesCollection fail (Excel 2000)

    The problem is in the line Do Until x = 4. You never assign x a value in your code, so - since x has been declared as an Integer - it has the default value 0. But there is no ChartObjects(0) or SeriesCollection(0) element. Elements of a collection are counted starting at 1.

    Moreover, Worksheets("CHARTSDAYSOFWEEK").ChartObjects(x).Cha rt.SeriesCollection(x) doesn't make sense - you're using the same index for the ChartObject and for the Series.

    See if you can use these remarks.

Posting Permissions

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