Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Charting Weirdness and VBA

Hi Terri,

As it did for Markus your code works fine for me, to be
effective I needed to change the legendentry background
transparency.

Are all the "types" your series of the same ChartGroup,
eg BarGroups, LineGroups etc. Are they all on the same
category axis. Any trend lines. Have you ever deleted and
inserted a new series. I assume you simply have a line or
XY scatter, so the latter might be a possibility in your
case.

The point is the Series collection does not necessarily
correlate in index order with the Legend series, even
though it typically does.

If you think this is a possibility it gets complicated to
relate them. And just for reference (doubt applies to
you) if a legend entry has been user deleted it's
virtually impossible to do so with certainty, I've spent
many hours trying!

Regards,
Sandy



-----Original Message-----

I have a chart with 9 series, and macro that will make

them hidden or
visible, depending on the contents of a range of 9 cells

in a
worksheet ("IR-Graph")

An odd thing happens sometimes with the the 9th series.

I get an run
time error 1004 (Unable to get property of LegendEntry

class).
Through a lot of trial and error, I found that this error

only occurs
with the 3rd series is turned 'on'.

Since both cases in the IF...THEN block have multiple

actions on the
LegendEntries, I turned off Series #3 and stepped through

the code.
After first line clears (either case) I know Series #9

exists and
there's no error. Then I turn Series #3 off, which

*shouldn't* affect
Series#9. When I step into next line of code I get the

error. When I
turn Series #3 back off, I'm able to advance to next line

of code
again.

I'm usually pretty good at debugging but this is too

weird. Help!



Sub Graph_Legend(oCht As Chart)
Dim Counter As Integer
Application.ScreenUpdating = False

With oCht
For Counter = 1 To 9

If Sheets("IR-Graph").Cells(Counter + 2, 1).Value = 0

Then
' Turn graph line off
.Legend.LegendEntries

(Counter).LegendKey.Border.LineStyle =
xlNone
.Legend.LegendEntries(Counter).Font.ColorIndex = 2
Else
' Turn graph line on
.Legend.LegendEntries(Counter).Font.ColorIndex =

xlAutomatic
.Legend.LegendEntries

(Counter).LegendKey.Border.ColorIndex =
xlAutomatic
.Legend.LegendEntries

(Counter).LegendKey.Border.Weight =
xlMedium
End If
Next Counter
End With

Application.ScreenUpdating = True
End Sub

Terry Detrie

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrow key weirdness Earl Kiosterud Excel Discussion (Misc queries) 3 April 7th 08 03:12 AM
VLOOKUP weirdness Dave Excel Worksheet Functions 2 November 5th 06 03:22 PM
Excel weirdness!!!! MattShoreson Excel Discussion (Misc queries) 5 July 6th 05 01:43 PM
Conditional Sum weirdness . . . WillRn Excel Worksheet Functions 1 February 17th 05 10:46 PM
Charting Weirdness and VBA Markus Grein Excel Programming 0 February 7th 04 06:59 AM


All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"