ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting strange error in formatting chart objects (https://www.excelbanter.com/excel-programming/351218-getting-strange-error-formatting-chart-objects.html)

grime[_13_]

getting strange error in formatting chart objects
 

My workbook contains a scatter graph that graphs locations based on X-
coords.

My VBA code changes the appearance of each of the "points" on m
scatter graph based on numerous criteria (changes color, size, etc..)

For some reason, it gives me an error when I get to the last "point".

Here is the code:

Code
-------------------
For i = 1 To Worksheets("Data - Personnel").Range("G2").Value
If Worksheets("Geography").Range("F" & i + 1).Value = "H" Then
BkgdColor = 46 'orange
FrgdColor = 53 'dark orange
Else
BkgdColor = 41 'blue
FrgdColor = 11 'dark blue
End If
If Worksheets("Geography").Range("AA" & i + 1).Value < 200 Then
MarkerSz = 18
ElseIf Worksheets("Geography").Range("AA" & i + 1).Value < 400 Then
MarkerSz = 21
ElseIf Worksheets("Geography").Range("AA" & i + 1).Value < 600 Then
MarkerSz = 24
ElseIf Worksheets("Geography").Range("AA" & i + 1).Value < 800 Then
MarkerSz = 27
ElseIf Worksheets("Geography").Range("AA" & i + 1).Value < 1000 Then
MarkerSz = 30
Else
MarkerSz = 33
End If
With Worksheets("Resources").ChartObjects("GeographyCha rt").Chart.SeriesCollection(i)
.MarkerBackgroundColorIndex = BkgdColor
.MarkerForegroundColorIndex = FrgdColor
.MarkerStyle = xlCircle
.Smooth = False
.MarkerSize = MarkerSz
.Shadow = False
End With
Next
-------------------


Please help

--
grim
-----------------------------------------------------------------------
grime's Profile: http://www.excelforum.com/member.php...fo&userid=1922
View this thread: http://www.excelforum.com/showthread.php?threadid=50411



All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com