working with Seriescollection Values

CalvinGraham

Board Regular
Joined
Jan 27, 2010
Messages
67
This has been driving me demented for about half an hour, I've tried all sorts of versions but I can't seem to access the values in the chart. I'm trying to count how many non-zero values are plotted on the bar chart and keep a tally in the variable InstancesCount:

Code:
With TheChart
        ReDim TheCauses(.SeriesCollection.Count) As String
        FilterType = Sheets(TheSheet).Range("ChartData_Plotted" & Right(.Name, 1)).Resize(1, 1).Offset(0, -1).Value
        For ii = 1 To UBound(TheCauses)
            With .SeriesCollection(ii)
                TheCauses(ii) = .Name
                For jj = 1 To .Points.Count
                    If .Values(jj) <> 0 Then InstancesCount = InstancesCount + 1
                Next jj
            End With
        Next
    End With
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
For anyone that comes across this with the same problem, the solution was to use an index function

If Application.Index(.Values, jj) <> 0 Then InstancesCount = InstancesCount + 1
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top