+ Reply to Thread
Results 1 to 1 of 1

Using VBA to change the graph series values...Need help

  1. #1
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Using VBA to change the graph series values...Need help

    Hi,

    I am working on graph auto update for X-axis. Macro A is for graph format and Macro B is for X-axis.

    Macro A:
    ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlValue).MaximumScale = [R2]

    Macro B:
    ActiveSheet.ChartObjects("Chart 1").Chart.SeriesCollection(3).Values = [AD2]

    AD2 = 'Sheet1'!$AQ$3:$AQ$9

    Macro A is working but cant get the macro B to work. What ever values added after macro B's = will be show in the graph series values. So there are no link to the spreadsheet. Series value shows ='Sheet1'!$AD$2 instead of ='Sheet1'!$AQ$3:$AQ$9

    Below is the macro I get from recording:

    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.SeriesCollection(3).Name = "=""Line 1"""
    ActiveChart.SeriesCollection(3).Values = "='Sheet1'!$AQ$3:$AQ$9"

    May I know what syntax should be replacing [AD2] since it refer to a formula instead of a value? I get this from other forum.

    I need [AD2] to be link to the excel spreadsheet because any changes can be directly change in the spreadsheet.

    Thank you.
    Last edited by DavidRoger; 09-25-2012 at 05:59 AM. Reason: Renew question

+ 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