+ Reply to Thread
Results 1 to 5 of 5

create chart in VBA

  1. #1
    Registered User
    Join Date
    05-22-2008
    Posts
    5

    create chart in VBA

    hello,

    does anybody here have an example on how to handle histograms in VBA please?

    I have a loop where the "i" are the X axis values
    the formula inside the loop returns the Y axis values

    how do I pass the (XY) series to an histogram in vba without having to write the X and Y into cells then select the range and create the histogram??

    thanks!
    Alex

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,440
    These lines entered in the immediate window should give you a clue.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    05-22-2008
    Posts
    5
    so the idea is to store the values in an array and to load the values in:

    activechart.SeriesCollection(1).values=array(1,2,1)
    activechart.SeriesCollection(1).xvalues=array(1,2,3)

    do I need to empty the array once it's done??

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,440
    Once it's done you can do what you like with the array as it will not be linked to the chart.

    Note that the series formula will contain those values, and the formula will be limited to 1023 characters. So depending on your data you may not be able to complete this task.

    =SERIES(,{1,2,3},{1,2,1},1)

  5. #5
    Registered User
    Join Date
    05-22-2008
    Posts
    5
    thanks Andy!
    I was not aware of the limitations: I will check the data series as you suggested.

+ Reply to Thread

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