Predetermining graph lines

Red over White

Board Regular
Joined
Jul 16, 2011
Messages
132
Office Version
  1. 365
Platform
  1. MacOS
I currently have a line graph which has between 20 and 25 lines showing performance over a period. There are times that I have to add lines for short periods and want to be able to specify the thickness of the line as well as predetermine color it should be. I am assuming that I can do the first part by macro, but am wondering how to do the color element - by reference to a cell with that color in. Any suggestions/help would be appreciated, I use Office Mac:2011
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
To do this, do the following:

1) You can create a dummy series that only shows a line if data is entered.
=if(isnumber(a1),a1,na()) - NA() will not show up in the chart

or alternately you can choose to show or not

=if(showdata="Yes",a1,na()) - show data is cell in the worksheet that you point to to see if the data line should be shown in the chart.


2) Add the data line for your dummy set and then modify the line size and color as needed. Then when you show the data it will have its own style, but will not show up when not entered or chosen.

You can create as many of these dummy series as you need for different colors or size or whatever you want to show.

Let me know if you need more help.

Steve=True
www.exceldashboardtemplates.com
 
Upvote 0
Steve

Thanks for your help. I can see where you are coming from and it works for the start and end of the line. What I should have made clearer in the original posting is that I was looking to use the same column for two separate entries (say B3:B6 and B9:B14) but it looks as though interpolation will scupper that.

On the second element I have started to develop a macro that reads:

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = D14 'where cell D14 = RGB(0, 0, 255) or red
End Sub

but this doesn't work, but then I would still need to work out how to assign the particular line on the graph to the graph. Am I asking for the impossible? I may not be back until the weekend so don't bust a gut over it
<table style="border-collapse: collapse;width:85pt" border="0" cellpadding="0" cellspacing="0" width="85"><tbody><tr style="height:17.0pt" height="17"><td style="height:17.0pt;width:85pt" height="17" width="85">
</td></tr></tbody></table>
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top