Consulting

Results 1 to 5 of 5

Thread: Sleeper: Using vba variable to create data series for pi and bar graphs

  1. #1
    VBAX Newbie
    Joined
    Jun 2005
    Posts
    2
    Location

    Sleeper: Using vba variable to create data series for pi and bar graphs

    I am relitivly new to VBA. I have been working with VB 6.0 for some time. But am still getting used to the Excel object model. I have variables in VBA and need to create new data series on both pie charts and bar graphs. I need to create new series in VBA using variables, strat(0), strat(1),,,,, If you have any idea on the line of code needed for this please help.

    Justin

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by jjpratt
    I am relitivly new to VBA. I have been working with VB 6.0 for some time. But am still getting used to the Excel object model. I have variables in VBA and need to create new data series on both pie charts and bar graphs. I need to create new series in VBA using variables, strat(0), strat(1),,,,, If you have any idea on the line of code needed for this please help.
    Why not just do it in Exel with the macro recorder turned on?

  3. #3
    VBAX Newbie
    Joined
    Jun 2005
    Posts
    2
    Location
    I have to create about 80 different charts and it is just easier if I could just pass values to a sub that creates the pie and bar graphs. The code I have tried is:

    co1.Chart.SeriesCollection.Add
        Source:= strat(0)
    This does not work, but I need to use the variables as my series.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by jjpratt
    I have to create about 80 different charts and it is just easier if I could just pass values to a sub that creates the pie and bar graphs.
    If you record one, that will give the basis and with your VB knowledge you should be able to make into a generic function.

  5. #5
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    268
    Location
    There are quite severe limitations on using variables as source data. See:
    http://www.vbaexpress.com/forum/showthread.php?t=3374

Posting Permissions

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