PDA

View Full Version : Change line color for new series programatically



realitybend
07-21-2008, 09:09 AM
I have a sheet with column A containing the Category (X) axis labels, and C containing the data. There is a line chart which displays the data. I need the most recent data to have a different color line in the chart. I'd imagine that this would involve two lines, but I don't know how to do it.

Thanks for your help.

Bob Phillips
07-21-2008, 11:51 AM
Post the workbook and tell us what you want a new colour.

realitybend
07-21-2008, 11:58 AM
Attatched is an example workbook. This time, I want the data from rows 8 on down to be red instead of pink. Next time I update the file, I will want rows 12 and down to be red and the rest normal. Each time its updated, the new data needs to be a different color, and the now-old data needs to be changed back. (Red and pink are just examples)

Bob Phillips
07-21-2008, 02:58 PM
Is this what you mean

realitybend
07-21-2008, 03:11 PM
Yes, that's what I want it to do. Thanks! The problem is that when I add data next time, say rows 12 through 18, I need it to have everything else pink and those rows red.

mdmackillop
07-21-2008, 04:06 PM
Please read this (http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_posthelp_faq_item). We expect posters to try to work out their own problems. Given the speed of your response, I don't see how you can have attempted your own solution based on the previous posting.

realitybend
07-22-2008, 03:12 PM
I apologize. I definitely understand that each user must do as much as possible on the code themselves. I did try before I posted yesterday, but gave up as I didn't know what I was doing. I've attempted it for another day, but as I'm relatively new at this, I'm not able to make any progress.

Bob Phillips
07-22-2008, 03:30 PM
How do you decide wich rows are red and which pink in these differing circumstances?

mdmackillop
07-22-2008, 03:31 PM
We're happy to help. so please post your "best efforts". There are often many solutions. It doesn't mean your approach is wrong, but without seeing your approach, a posted solution may not be the best way of assisting your understanding.

realitybend
07-22-2008, 04:03 PM
In the attatched example I would have updated it at row five, row 8, and row 11. As you can see, I made the data green. At the end of every update I guess I'll have to make the last cell green manually. I guess what I'm thinking is that it needs to make the graph red from where the second to last green cell is to the end? (e.g. rows 8 - 11)?

I'm not sure how to procede here.

Thanks for your time and effort.