+ Reply to Thread
Results 1 to 5 of 5

Find and Replace in Charts

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    5

    Find and Replace in Charts

    Hi,

    I am wondering if anyone knows how to find and replace on Excel charts??

    For example I have the following

    'Sheet1' Worksheet on Workbook 1
    'Results' Worksheet on Workbook 1

    'Sheet 2' Worksheet on Workbook 2
    'Results' Worksheet on Workbook 2

    I have copied a chart from 'Sheet 1' on Workbook 1 to 'Sheet 2' on Workbook 2.

    How can I replace the references on the Chart to 'Sheet 1' on Workbook 1 to 'Sheet 2' Workbook 2?

    I have about 25 charts I am looking to do this for so I am looking on tips that would allow me to do this quickly...Possibly a macro which works.

    Many thanks in advance.

    Sagar

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,031

    Re: Find and Replace in Charts

    Do you mean update range references that appear in the SERIES formulas?

    Install and run this code in your Workbook2, Worksheet2 code module. (This is suitable for a one-time update but is not highly robust against weird condtions.)

    ' Update all charts to use a different sheet reference
    Public Sub Update()
       Dim ch As ChartObject
       Dim s As Series
     
       For Each ch In ChartObjects
          For Each s In ch.Chart.SeriesCollection
                s.Formula = Replace(s.Formula, "Sheet1", "Sheet2")
          Next s
       Next ch
     
    End Sub
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: Find and Replace in Charts

    http://peltiertech.com/Excel/Charts/ChgSrsFmla.html
    Cheers
    Andy
    www.andypope.info

  4. #4
    Forum Contributor
    Join Date
    10-09-2012
    Location
    Adelaide, South Australia
    MS-Off Ver
    Excel 2010
    Posts
    135

    Re: Find and Replace in Charts

    Does this just update chart on the current worksheet?

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,031

    Re: Find and Replace in Charts

    For the code I provided, it depends on where you put the code. If you put the code in a Sheet module, as what I recommended to the OP, it will update the charts on that worksheet. If you put it in a Module module, it will update the charts in the active worksheet. But in either case, it only updates charts on one sheet.

+ 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