Thanks Andy.
Deleting or assigning series based on empty cells will cause a problem.
If you switch chart type to column before deleting that should help.
I have also changed the way the ranges are assigned so only values rows are used.
Hi Andy:
Thank you for your kind response.
When I tried opening the file you sent, it display a Run time Error: '9', Subscript out of range. What could have triggered this? Thanks.
- Ravi
Hi Andy:
Another observation was that the Pay Policy line is flat on the axis, which should not be the case. Thanks.
- Ravi
The subscript error is caused by you selecting a sheet that does not exist in the file.
Check the range used for that series, is it correct?Code:Private Sub Workbook_Open() UserForm1.Show Sheets("Splash Screen").Select ' No sheet End Sub
Hi Andy:
I will check on what you have asked and let you know.
Meanwhile, I noticed that you have created a Macro1. Not sure where you are calling this routine from though. Thanks.
- Ravi
Probably redundent code used whilst testing.
I use the macro recorder to generate code sometimes![]()
Hi Andy:
Here is the problem I am experiencing:
When displaying the pay structure graph, it displays correctly the first time this button is clicked. However, on any subsequent occasions, it does not display the pay grade or pay range lines, except for the first pay grade. It also gives the following message: “Run Time Error 1004 – This object has no legend."
I have attached the file for your convenience. Thanks.
make sure the chart has a legend before excuting the command
Code:ActiveChart.HasLegend = True ActiveChart.Legend.LegendEntries(ActiveChart.Legend.LegendEntries.Count).Delete
Hi Andy:
Thank you for your kind response.
I included the statement you suggested and tested the outcome. Wheat I see happening now is that I keep getting legends such as "Series 4", "Series 5" and so on with each time the Display Graph button is clicked. Is this expected?
Thanks.
- Ravi
I don't get this when testing.
You already have code to remove excess series
Code:'Delete any series beyond Series 3 - July 18, 2008 With ActiveSheet.ChartObjects(1).Chart Do While .SeriesCollection.Count > 3 .SeriesCollection(4).Delete Loop End With
Hi Andy:
Thank you for your kind response.
As stated in my previous email, I added the code you suggested. Then here is what I did:
1. Clicked the Display Graph button
2. The graph was displayed properly with the legends Maximum $, Minimum $, and Pay Policy Line displayed partially in the gray area of the chart.
3. Clicked the Return button above the graph
4. For testing purposes, I clicked again on Display Graph. Observed that a new legend Series4 was introduced along with those stated in (2) above.
My assumption is that if the Display Graph button is clicked more than once, then the above can happen.
Can this be prevented, since the Display Graph button can be clicked many times for various reasons.
Also can the font of the legends on the right side of the graph be reduced, then perhaps they won't show up in the gray area of the graph.
Thanks Andy.
- Ravi
P.S. I tested on a clean copy and noticed that the first time the Display Graph button was clicked, the legend on the right side of the graph were in a small rectangle and was displayed on the top right corner and just had Maximum and Minimum. When I clicked the Display Graph button again, then the same legend was display right in the gray area of the graph and included the "Pay Policy Line".
Last edited by ravichander; 11-08-2009 at 04:29 PM. Reason: To include another observation
I still can not reproduce the problem you describe.
I can press multiple times the display and return button. I can even delete legend entries or the whole legend and the chart is rebuit.
change font size using
Code:ActiveChart.Legend.Font.Size = 10
Andy:
Thank you for your kind response.
For your convenience, I have attached a test copy that illustrates what I have been experiencing. Try the attached file to see what goes on. Thanks.
- Ravi
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks