+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Graph named series not copying with sheet

  1. #1
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Graph named series not copying with sheet

    Afternoon all,

    I have a worksheet that is intended to be duplicated in its workbook as many times as is required.

    The worksheet contains a graph, for which the data is in dynamic named ranges specific to the worksheet.

    When I make a copy of the worksheet, the sheet is successfully duplicated, as are the named ranges. However, the graph no longer refers to the named ranges, rather the static range that was defined by the dynamic range prior to copying.

    Am I doing something wrong, or is there a workaround for this?

    Thanks,

    Dave
    Attached Files Attached Files
    Last edited by sweep; 12-02-2010 at 10:00 AM.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

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

    Re: Graph named series not copying with sheet

    That's just how it works. The named ranges are replaced with references.

    You will need to rebuild the named ranges in the newly copied sheet.

    This quick and dirty code will produce a copy sheet and update the formula.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Graph named series not copying with sheet

    Thanks Andy,

    I'd come up with much longer code than that!

    Cheers,

    Dave

  4. #4
    Registered User
    Join Date
    11-09-2010
    Location
    helston, england
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Graph named series not copying with sheet

    Hello

    im trying to get the code that was posted above to work with the chart in the attached workbook. hoping that to copy the sheet and maintain the chart dynamic references you can just click the "copy sheet" button.Cyanidation Template - 2012.xlsm

  5. #5
    Registered User
    Join Date
    08-07-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    2013
    Posts
    1

    Re: Excel 2007 : Graph named series not copying with sheet

    I have the same problem as the person that posted the thread: I have a chart with series values that are defined names. When you copy the worksheet to a new worksheet the series values are turned into cell references instead of referencing the new worksheet and the defined names.

    I copied the above code and have tried to run it, but it stops at the line:

    objSeries.Formula = Replace(chtMaster.SeriesCollection(lngIndex).Formula, "Master", "'" & objCopy.Name & "'")

    with 'Run-time error 1004: Application-defined or object-defined error'.

    I am still learning VBA, and I can't see what is wrong. All of the variable values look OK to me but I'm must be missing something. I am using Excel 2013, could that be an issue?

    I have more than 100 charts that need to be copied, plus more on an ongoing basis. I would hate to have to do them manually. Can you please help?

    I would greatly appreciate any advice.

+ 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