+ Reply to Thread
Results 1 to 5 of 5

Unable to set properties of series class - Clear all series information?

  1. #1
    Registered User
    Join Date
    06-18-2008
    Posts
    32

    Unable to set properties of series class - Clear all series information?

    I am having some problems with one of my workbooks. The original file seems to work fine, but when I move it, sometimes I get Run-Time error '1004' some times I don't.

    The problem arises when I try to change any of the .SeriesCollection values. In my workbook when I run my macro, it will fail at .SeriesCollection(1).Name = "10 Passes". Chart 2 already exists with 6 series' already defined. It seems that when I manualy go through and delete all the information out of each series (ie Right Click -> Source Data -> Series and delete name and set X and Y values to zero) the macro will run just fine.

    Would it be best to:
    1. Delete each series in each chart, then recreate them each time, or
    2. Delete all the series information out of each SeriesCollection each time I run the macro?
    Or is there some setting I need to change, or code to add to make it work correctly?

    Please Login or Register  to view this content.
    I am stumped. I fail to understand how it can work perfectly one minute, but when I move it, it fails. It should also be noted that I have no external links in my project.

    Hope someone can help!

    Thanks,

    Eric

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Do any of the series have missing or NA data when the code fails?

    As you are doing this all with code I would add error handling. Update series first and if it causes an error simply clear all series and rebuild.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    06-18-2008
    Posts
    32
    It is possible that there are empty cells in the series as there might not be as much data in the series as there would have been previously. The only one that confuses the heck out of me is when .Name = some text value that isn't a variable and I am still unable to change it and get runtime error. Is there a way to clear out the series before I populate it again? I have tried .Name/.Values/.XValues = "" and was unsuccesful. Right now I just cleared everything out of all the series manually and saved it like that read-only which works for me, but I am worried someone in the future will edit it and have the same problem as I have now.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434
    Have you tried using the macro recorder when clearing out the series information?

    Is the chart type a line type? I think column charts are more tolerant of missing/empty data when using code. You might be able to change chart type whilst setting references and the change back to line after.

  5. #5
    Registered User
    Join Date
    06-18-2008
    Posts
    32
    This is what I get when I do a macro when I manually clear it out

    Please Login or Register  to view this content.
    Which is funny because If I put this exact code in my original module/macro, it will fail.

    I believe I used a scatter plot with connecting lines. I will try changing it, then changing it back and see what happens.

    Thanks,

    Eric

+ 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