+ Reply to Thread
Results 1 to 4 of 4

copying template sheet containing chart with dynamic range

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

    copying template sheet containing chart with dynamic range

    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

    the below is code posted by someone else on this forum, i cant get it to work with my sheet.. may be due to the chart not being named the same but im not sure??

    Can anyone help?

    Sub CopyMaster()

    Dim chtMaster As Chart
    Dim objSeries As Series
    Dim lngIndex As Long
    Dim objCopy As Object

    Set chtMaster = Worksheets("Master").ChartObjects(1).Chart
    lngIndex = 0
    With ActiveWorkbook
    .Worksheets("Master").Copy after:=.Sheets(.Sheets.Count)
    Set objCopy = .Sheets(.Sheets.Count)
    End With

    For Each objSeries In objCopy.ChartObjects(1).Chart.SeriesCollection
    lngIndex = lngIndex + 1
    objSeries.Formula = Replace(chtMaster.SeriesCollection(lngIndex).Formula, "Master", "'" & objCopy.Name & "'")
    Next

    End Sub

  2. #2
    Forum Contributor
    Join Date
    08-11-2004
    Posts
    109

    Re: copying template sheet containing chart with dynamic range

    Explain exactly what you are trying to do and maybe I can help. Why can't you just copy the sheet, it should work.

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

    Re: copying template sheet containing chart with dynamic range

    if you simply copy the sheet/template that contains a chart linked to the dynamic range it stays linked to the dynamic range data on the original template sheet and not the data on the new sheet you are creating. I need to duplicate this template as many samples will be tested at one time or for a project.

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

    Re: copying template sheet containing chart with dynamic range

    i can go into the chart and reassign the ranges for the chart but this kind of defeats the object of a template

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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