Schadenfreud
New Member
- Joined
- Jan 22, 2014
- Messages
- 29
I have this chart and I'm trying to resize its points depending on the 'Size' values [D2:D8]. I found some code that should resize the points depending on some values, but it gives me 'Run time error 91 object variable or with block not set'.
Here's the said code:
Code:
Sub ChangeScatterplotSizeMarker()
Dim rngSizes As Range
Dim lngIndex As Long
' range containing marker size
Set rngSizes = Range("D2:D8")
With ActiveChart
With .SeriesCollection(1) <-- error 91 here
For lngIndex = 1 To .Points.Count
With .Points(lngIndex)
.MarkerSize = rngSizes.Cells(lngIndex).Value
.MarkerBackgroundColorIndex = _
rngSizes.Cells(lngIndex).Interior.ColorIndex
.MarkerForegroundColorIndex = _
rngSizes.Cells(lngIndex).Interior.ColorIndex
End With
Next
End With
End With
End Sub