dcsimg
Results 1 to 4 of 4

Thread: Problem trying to assign values to chart FullSeriesCollection

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2018
    Posts
    257

    Problem trying to assign values to chart FullSeriesCollection

    I need to assign different column ranges to multiple chart and for that I thought of using array to store the values and then assign that array to chart’s FullSeriesCollection. However, all I get is just zeros. Here are my codes;
    Code:
    
    For i = LBound(Teams) To UBound(Teams)
    
         ActiveChart.FullSeriesCollection(1).Name = "2018 - Result for team: " & Teams(i)
         ChartValues = ChaGetTheChartValues(ThisWB, i + 4)
         ActiveChart.FullSeriesCollection(1).Values = ChartValues
    
    Next i
    
    Function ChaGetTheChartValues(ThisWB As Workbook, CulumnValue As Integer)
    TempString = ""
       For i = 0 To 13
        TempString = TempString & ThisWB.Worksheets("Overview2").Cells(20 + i, CulumnValue).Value & "|"
       Next i
        
         If Len(TempString) > 0 Then
          TempString = Left(TempString, Len(TempString) - 1)
         End If
         ChaGetTheChartValues = Split(TempString, "|")
    End Function

    Name:  2019-01-07_22-14-34.jpg
Views: 245
Size:  11.8 KB

    I also noticed just now that the title does not get changed either
    I have verified that the function get the correct values. Is it because I am trying to pass strings as values which should be numbers?
    Any help is appreciated.

    Thanks.
    Last edited by Grand; Jan 7th, 2019 at 04:19 PM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    33,631

    Re: Problem trying to assign values to chart FullSeriesCollection

    Moved to Office Development, as it looks like an Excel project.
    My usual boring signature: Nothing

  3. #3
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,550

    Re: Problem trying to assign values to chart FullSeriesCollection

    I think ChartValues is a string array, and needs to be converted to numbers. I would suggest creating a second array of some numeric type and populating it from ChartValues, then use the 2nd array to update the .values for the charts.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,162

    Re: Problem trying to assign values to chart FullSeriesCollection

    post a workbook with some sample data, zip first
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width