Results 1 to 3 of 3

Thread: Setting Chart Data points with an array?

  1. #1
    Join Date
    Jun 2012
    Posts
    3

    Setting Chart Data points with an array?

    I have a piece of code (vba) that goes through each row and gives it a graph (this works), however, due to the nature of the spreadsheet (Excel) I am working in, there may be as few as 2-5 data points and up to 20. Because of this, I can not simply hard code the columns of data and let the row number change as I previously had it. I have set up a selectcase statement that takes the two defining column factors, subtracts them and gives me how many columns I need that then inputs the correct amount of "A" & Row# & ",B" & Row# etc, into a string, however when I use the ActiveChart.SetSourceData Source:=Range(ColumnAmtStr) statement I get either an error of 448 "Named argument not found" or 1004 "Method 'Range of object '_Global' failed".

    Any words of advice?

  2. #2
    Join Date
    Dec 2007
    Posts
    2,297

    Re: Setting Chart Data points with an array?

    Can you go in the VBE, do Tools > References, and look to see if one of the checked references (which are all at the top of the list) starts with MISSING. Try to just uncheck it and see if the error disappeared. If that doesnt work then create a new module and put the code in there instead of the worksheet.

  3. #3
    Join Date
    Jun 2012
    Posts
    3

    Re: Setting Chart Data points with an array?

    I found out that the problems were:

    A.) I was using a String rather than a Range

    B.) I did not include the sheet it was meant to get said data points from.

    C.) I used "ActiveChart.SetSourceData Source:=Range(ColumnAmtStr)" when the correct format for a Range object was
    "ActiveChart.SetSourceData Source:=ColumnAmtStr"

    This one is as good as solved! Thanks for the help though.


Similar Threads

  1. There is no data in Excel Pie Chart
    By Tarani in forum MS Office Support
    Replies: 2
    Last Post: 25-02-2012, 11:27 AM
  2. Data points in Excel chart not lining up with axis
    By mbbackus in forum MS Office Support
    Replies: 1
    Last Post: 10-01-2012, 10:58 AM
  3. Replies: 5
    Last Post: 22-08-2010, 02:45 AM
  4. How to Create, edit or delete an array formula or Pivot Chart
    By agarwalm11 in forum Guides & Tutorials
    Replies: 1
    Last Post: 31-12-2009, 11:22 AM
  5. Mark data points in Excel line chart
    By Amie in forum Windows Software
    Replies: 3
    Last Post: 11-06-2009, 07:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •