Create Chart With Dynamic Named Ranges

  • I am trying to write a macro that will create a new column chart which only use as many rows of data as available as its datasource i.e. dynamic named ranges.

    However each time I get an error saying "unable to set values properties of a series class"

    Can someone please advise me how best to do this?


  • Re: Create Chart With Dynamic Named Ranges

    I think the problem is that you are Dim'ing rng and val as ranges, then declaring them as strings...

    As .XValues and .Values as members of the .Series object are variants they can be either a string or a range, but not both.

    Make sense?

  • Re: Create Chart With Dynamic Named Ranges

    hi there,i assume this need named range
    probably like below..........i simply turn record on macro reader. sorry not define variables.

    regards/junho lee

  • Re: Create Chart With Dynamic Named Ranges

    This has been really really helpful guys. Worked like a charm and I'm ecstatic. Can't thank you enough, having spent the past 3 days trying to debug this on my own.

  • Re: Create Chart With Dynamic Named Ranges

    Apologies if this question sounds a bit silly but I have since tried the trick below and it worked well.

    However now I need to create multiple charts (pie charts and column charts). I have created this individually with the code below

    I want the pie charts to display labels in terms of percentages while the column chart should display actual values in the spreadsheet (please note that these are expressed in percentages) which is not happening at the moment.

    The other problem is that when I run the code below (attached to a command button) to create all 3 charts at the same time, it just uses the first named range to plot all charts.

    Can you please help? I have attached part of the spreadsheet for your consideration.

    Private Sub Graphs_Click()
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!