Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Interior color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paal - 20 Mar 2006 16:06 GMT
Hi, I have the following code which generate a chart with three series. I'm
struggling with solving how I can set the color of the different series. So
any suggestion.

Sub addchart()
With ActiveSheet
       Set objChart = .ChartObjects.Add(Left:=1, Width:=720, Top:=1,
Height:=425)
       objChart.Chart.ChartType = xlXYScatterSmoothNoMarkers
       PT001 = FinnSlutt("M")
       Xrange = "=Data!R12C13:R" & PT001 & "C13"
       Yrange = "=Data!R12C14:R" & PT001 & "C14"
       Result = NySerie(objChart, Xrange, Yrange, "=Data!R11C14", 1)
       PT002 = FinnSlutt("R")
       Xrange = "=Data!R12C18:R" & PT002 & "C18"
       Yrange = "=Data!R12C19:R" & PT002 & "C19"
       Result = NySerie(objChart, Xrange, Yrange, "=Data!R11C19", 2)
       If (Worksheets("Data").Range("AB12").Value <> "") Then
           TT001 = FinnSlutt("W")
           Xrange = "=Data!R12C23:R" & TT001 & "C23"
           Yrange = "=Data!R12C24:R" & TT001 & "C24"
           Result = NySerie(objChart, Xrange, Yrange, "=Data!R11C24", 3)
       End If
       With objChart.Chart
           .PlotArea.Interior.ColorIndex = xlNone
           .Refresh
           .Axes.MinimumScale = 0
           .ax .MaximumScale = 370
       End With
end sub
Function NySerie(objChart, Xvalues, Yvalues, Name, x)
   objChart.Chart.SeriesCollection.NewSeries
   objChart.Chart.SeriesCollection(x).Xvalues = Xvalues
   objChart.Chart.SeriesCollection(x).Values = Yvalues
   objChart.Chart.SeriesCollection(x).Name = Name
End Function

I have tried with this but get only error.    
objChart.Chart.SeriesCollection(1).Interior.ColorIndex = 5
   
Thanks
Paal
   
Tom Ogilvy - 20 Mar 2006 16:38 GMT
for a scatter plot, it would be

objChart.Chart.SeriesCollection(1).Border.ColorIndex = 5

Signature

Regards,
Tom Ogilvy

> Hi, I have the following code which generate a chart with three series. I'm
> struggling with solving how I can set the color of the different series. So
[quoted text clipped - 39 lines]
> Paal
>    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.