Automatic control of line properties

D

Doug

Hi,

I want to make several line graphs with 100s of lines, but Excel (as
far as I can tell) puts all lines as 2 pixel default thickness. Then,
it makes me change line or color one (slow!) line at a time.

How can I tell Excel that the default should be the thinnest line is
will allow?

Better: Is there a way to read in data that gives separate colors to
lines corresponding to data in certain categories?

If you can respond via e-mail too, to (e-mail address removed), I'd very
much appreciate it.

Thanks,

Doug
 
J

Jim Gordon MVP

Hi Doug,

There are four possible line thickness choices in Excel. You probably
noticed a line's default size is the second thinnest.

Excel lines can have up to 56 different colors in any given workbook, but
you can also use up to 56 different colors with the markers, so you can have
slightly less than 56 squared combinations of line colors and marker colors.
Or is it 56 factorial? Regardless, it's still enough for your needs.

If your data is arranged in categories, you can use colors to differentiate
the categories.

Yes, you can adjust each line one-by-one, but you can also use visual basic
for applications or Applescript to automate this task. Are you willing to
attempt this on your own? In your particular case you can contact the
Educational Technology Center at SUNY University at Buffalo and ask for help
with creating a macro that would loop through your graphs and adjust the
colors to your liking.

The VBA code could be pretty simple. A loop would go through the collection
of lines where n is the line number starting with 1 and c is a number from 1
to 56 for colors:
ActiveChart.SeriesCollection(n).Select

then it would change the properties of each line:
With Selection.Border
.ColorIndex = c
.Weight = xlHairline
End With

and then lastly it would adjust the properties of the data markers:
With Selection
.MarkerBackgroundColorIndex = c
.MarkerForegroundColorIndex = c
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 3
.Shadow = False
End With


Once you have settled on a color scheme you can save the graph as a template
for later use. To do that, while a graph is selected use the Chart menu and
select Chart Type. Click the Custom Types tab. Change the Select From toggle
to User Defined, then click the Add button. Give the graph a name and
description. To make any template the default template, select it from the
list and click the Set as Default Chart button.

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.


----------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top