Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining Line Color for Excel graph

Status
Not open for further replies.

scottscott

Programmer
Dec 14, 2006
29
0
0
US
Hello,

Is there a way to determine the color of a line in an excel graph? I would like to store the color of the first line which excel picks and then plot the second line with the same color as the first line. See below:

'JV plot
With .Chart.SeriesCollection.NewSeries
y = ycol
X = xcol
.Values = Range("$" & y & "$5:$" & y & "$186")
.XValues = Range("$" & X & "$5:$" & X & "$186")
.Name = "='EXP Summary'!$A$" & 4 * i + j - 3
'cline = 'store color here
End With

'LV plot
With .Chart.SeriesCollection.NewSeries
X = xcol
zz = zcol
.Values = Range("$" & zz & "$5:$" & zz & "186")
.XValues = Range("$" & X & "$5:$" & X & "$186")
.Name = "='EXP Summary'!$A$" & 4 * i + j - 3
.Border.Color = cline 'Set color here
End With
 


hi,

You're almost there...
Code:
'JV plot
With .Chart.SeriesCollection.NewSeries
     y = ycol
     X = xcol
     .Values = Range("$" & y & "$5:$" & y & "$186")
     .XValues = Range("$" & X & "$5:$" & X & "$186")
     .Name = "='EXP Summary'!$A$" & 4 * i + j - 3
     cline =   [b].Border.Color[/b] 'store color here
End With

'LV plot
With .Chart.SeriesCollection.NewSeries
     X = xcol
     zz = zcol
     .Values = Range("$" & zz & "$5:$" & zz & "186")
     .XValues = Range("$" & X & "$5:$" & X & "$186")
     .Name = "='EXP Summary'!$A$" & 4 * i + j - 3
     .Border.Color = cline   'Set color here
End With
I'm guessing that x, y & zz are VARIABLES.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top