Results 1 to 6 of 6

Cant make Excel Chart to use Named Range for Series values in VBA

Threaded View

rocksan Cant make Excel Chart to use... 04-25-2012, 11:01 PM
rocksan Re: Cant make Excel Chart to... 04-26-2012, 03:55 AM
rocksan Re: Cant make Excel Chart to... 04-26-2012, 04:10 AM
JosephP Re: Cant make Excel Chart to... 04-26-2012, 06:15 AM
rocksan Re: Cant make Excel Chart to... 04-26-2012, 07:10 AM
JosephP Re: Cant make Excel Chart to... 04-26-2012, 07:26 AM
  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Cant make Excel Chart to use Named Range for Series values in VBA

    Hi guys,

    I have simple but unsolved problem trying to make an excel chart refer to named range to pull out the values in VBA. AS you can see in the code I put MyNamed Range instead of $X$X to make it dynamic. But when I run it, it generates a run time error 1004.

    ActiveSheet.Shapes.addchart.Select
        ActiveChart.ChartType = xlLine
        ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("MyNamedRange")
        ActiveChart.PlotArea.Select
        ActiveChart.SeriesCollection(1).XValues = "='Sheet1'!MyNamed_Range2"

    For the record MyNamedRange = Profit_generated_sheet1

    Whats wrong?
    Last edited by rocksan; 04-25-2012 at 11:05 PM.

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