+ Reply to Thread
Results 1 to 3 of 3

VBA to change source data of charts by sheetname

  1. #1
    Registered User
    Join Date
    03-14-2012
    Location
    jakarta
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA to change source data of charts by sheetname

    Hi everyone,

    I’m new in VBA, trying to find out solutions to my problems bymyself. But below is something I couldn’t make any progress.
    I have a monthly report file where I store input data in sheets named Jan, Feb etc. I produce the reports on separate sheets and name them as Jan Report ,Feb report as you may guess. I have 6-7 charts in report sheet where source data is from input sheets. When I start a report for new month, I simply copy and rename last month’s report sheet and work on it. However, all charts still refers to last month’s data and I’m updating source data of each series in each chart manually. This means about 50 link to be updated. I tried to find out a solution by writing something below. All I want to change sheet name in source data for next month.

    Please Login or Register  to view this content.
    By the way, when I copy the sheet and rename fit for new report generation, chart names are changed in new sheet, so the SeriesCollection function will not help?. I need a code to cover all chart objects in the active sheet.

    Thanks for your help.
    Regards
    Antak
    Last edited by arlu1201; 02-11-2014 at 12:59 AM.

  2. #2
    Registered User
    Join Date
    03-02-2013
    Location
    New York, N
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA to change source data of charts by sheetname

    Instead of VBA being the default goto plan, have you tried using Search and Replace across the work book to rename the cell references across all the worksheets?

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

    Re: VBA to change source data of charts by sheetname

    I just tested this scenario.

    Sheet with chart data called Jan. Sheet with chart object, linked to Jan, called JanReport.
    I select both Jan and JanReport sheet tabs. Used the Move/Copy dialog to copy the 2 sheets.
    Renamed Jan (2) to Feb.
    Renamed JanReport (2) to FebReport.

    FebReport was linked to Feb sheet.

    If you copy each sheet separately then the references will not update automatically.
    Cheers
    Andy
    www.andypope.info

+ 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