Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Greg,
Thanks very much for replying. I was wondering at the back of my mind when I posted this whether or not the length of the code would put people off, so thanks very much for taking the time and trouble to try and decipher it. Fortunately, I've managed to solve the problem. I was doing more research online this morning and by chance came across a comment from Jon Peltier. Apparently, when the Charts.Add command adds a new chart sheet to a workbook it sometimes adds an empty series to it, thus making the standard empty chart area appear, and sometimes it doesn't, hence just leaving the white space of the chart sheet. So first time through the Do-While loop the former was occurring and second time through the latter was occurring. The solution is to add the following immediately below the Charts.Add command: If ActiveChart.SeriesCollection.Count = 0 Then ActiveChart.SeriesCollection.NewSeries End If The way the macro adds series to the charts depends on a number of factors related to the nature of the data being plotted and the way the data worksheet is set up. The worksheet isn't terribly simple and, since I'm pretty new to VBA, this was the only way I could come up with to give the code the necessary 'decision-making' capabilities. However, I'd love to know how to improve the efficiency of my coding, so do you have any general pointers on sections of code that I should be looking to improve? Cheers, Chris -- Chris "Greg Wilson" wrote: Chris, I had a look at your post earlier but gave up trying to figure out what you were trying to do. IMHO, the problem is that the code is very long and there is a lot of selecting and offseting going on and we have to infur what is happening without having any idea how the worksheets are strucured. There is also a lot of inefficiency in the code and it really needs a major revamp. Since at this point it seems unlikely that anyone will respond, suggested is that you provide a simplified version of the worksheet layout as well as a description of what it is you are trying to do. Keep it simple. Expect responders to only provide the required code structure and adapt it to suit. And don't expect responders to supply all the chart formatting detail. Flesh it out yourself. This is just my own opinion granted. Best regards, Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding criteria to loop | Excel Worksheet Functions | |||
Use a loop to create multiple Charts - Suggestions ? | Charts and Charting in Excel | |||
Adding in loop | Charts and Charting in Excel | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming | |||
Loop through sheets, deselect charts | Excel Programming |