+ Reply to Thread
Results 1 to 4 of 4

Update all chart x axis in workbook according to a specific "master chart" VBA query

  1. #1
    Registered User
    Join Date
    09-02-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Update all chart x axis in workbook according to a specific "master chart" VBA query

    Hello, I'm hoping for some help on a VBA query. I'm very new to this all, and would love some guidance.

    I have a workbook which contains 40+ tabs/worksheets. Each tab corresponds to a subsurface well and contains 5 charts related to it. It is used as a monitoring file, so is auto updated when the new month's data is available.

    I want to be able to format only the X Axis scale on every chart in the workbook according to the very first chart in the very first tab.


    I’ve managed to come up with the following VBA code:



    Sub UpdateChartsBasedOnMaster()


    Dim wksCharts As Worksheet
    Dim oChrtObj As ChartObject

    Set wksCharts = Worksheets("IG105") '

    With wksCharts.ChartObjects("Chart 1").Chart '
    For Each oChrtObj In wksCharts.ChartObjects
    If oChrtObj.Name <> .Parent.Name Then
    oChrtObj.Chart.Axes(xlCategory).MinimumScale = .Axes(xlCategory).MinimumScale
    oChrtObj.Chart.Axes(xlCategory).MaximumScale = .Axes(xlCategory).MaximumScale
    End If
    Next oChrtObj
    End With

    Set wksCharts = Nothing


    End Sub



    Obviously this only works for the tab titled “IG105” and then I usually end up opening the VBA editor and changing that name to the name of the next tab (e.g. IG128, IG24, IG26, etc) and doing it for each worksheet.


    What do I need to change the code to in order to loop the whole workbook and change each X axis according to the X axis that I set on “Chart 1” in IG105?

    Any information is greatly appreciated, and I thank you in advance for your time.

  2. #2
    Registered User
    Join Date
    09-02-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Update all chart x axis in workbook according to a specific "master chart" VBA query

    Anyone have any ideas?

  3. #3
    Registered User
    Join Date
    09-02-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Update all chart x axis in workbook according to a specific "master chart" VBA query

    Bump******Bump

  4. #4
    Registered User
    Join Date
    09-02-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Update all chart x axis in workbook according to a specific "master chart" VBA query

    Bump. Bump. Bump.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Removing the "%" sign on Excel chart axis
    By Exorcist1 in forum Excel General
    Replies: 1
    Last Post: 05-21-2014, 08:54 AM
  2. Replies: 0
    Last Post: 08-04-2013, 02:00 PM
  3. Replies: 0
    Last Post: 07-08-2011, 02:25 PM
  4. Replies: 0
    Last Post: 06-08-2010, 03:27 PM
  5. [SOLVED] How do I format the x axis on a "lines on 2 axes" chart?
    By Becky B in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-05-2006, 05:30 PM
  6. [SOLVED] In a bar chart, how do I change the x-axis "category" labels?
    By thermactor in forum Excel General
    Replies: 1
    Last Post: 12-02-2005, 03:20 AM
  7. [SOLVED] "Broken" chart axis for data of different scales
    By Charlie in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-27-2005, 08:06 PM

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