Changing the color of a Series Collection using visual basic?

I am trying to change the color of a Series Collection using visual basic.  I 
have tried things like "Chart(1).SeriesCollection(2).Points.Interior.Color = 
3" among many others, if you could give me any help I would appreciate it.

Thanks


0
Koreef (1)
3/16/2005 9:21:03 PM
excel.charting 18370 articles. 0 followers. Follow

1 Replies
409 Views

Similar Articles

[PageSpeed] 37

Koreef,

The examples below assume you are working with embedded charts:

To change all of the series colors for all charts in a worksheet (edit out 
the markers if you don't want them):

Sub LoopSeries()
    Dim ws As Worksheet
    Dim ct As ChartObject
    Dim ser As Series
    For Each ws In Worksheets
        For Each ct In ws.ChartObjects
            For Each ser In ct.Chart.SeriesCollection
                    ser.Border.ColorIndex = 3
                    ser.MarkerForegroundColorIndex = 3
                    ser.MarkerBackgroundColorIndex = 3
            Next ser
        Next ct
    Next ws
End Sub

If you just want to do one chart, you can activate it by clicking on it 
once.  Then run this:

Sub LoopSeries()
    Set cht = ActiveChart
    Set Srs = cht.SeriesCollection
    For Each Sr In Srs
        Sr.Border.ColorIndex = 3
    Next Sr
End Sub

Another option that goes after the first chart in the workbook:

Sub LoopSeries()
    Set cht = ActiveSheet.ChartObjects(1).Chart
    Set Srs = cht.SeriesCollection
    For Each Sr In Srs
        Sr.Border.ColorIndex = 3
    Next Sr
End Sub

Finally, use this logic to go after a named embedded chart:

Sub LoopSeries()
    Set cht = ActiveSheet.ChartObjects("Chart 1")
    Set Srs = cht.Chart.SeriesCollection
    For Each Sr In Srs
        Sr.Border.ColorIndex = 3
    Next Sr
End Sub

Please post back if you are referring to chart sheets.

----
Regards,
John Mansfield
http://www.pdbook.com


"Koreef" wrote:

> I am trying to change the color of a Series Collection using visual basic.  I 
> have tried things like "Chart(1).SeriesCollection(2).Points.Interior.Color = 
> 3" among many others, if you could give me any help I would appreciate it.
> 
> Thanks
> 
> 
0
3/17/2005 3:17:03 AM
Reply:

Similar Artilces:

Using Doxygen's \callergraph command ???
So far I can only get Doxygen to generate callergraphs for ALL functions or for NO functions, Doxygen seems to be ignoring the \callergraph command. Does anyone know how to limit Doxygen to producing complete callergraphs (the entire function call sequence that ends up at a specific function) for a limited number of functions? PeteOlcott wrote: > So far I can only get Doxygen to generate callergraphs for ALL > functions or for NO functions, Doxygen seems to be ignoring the > \callergraph command. Does anyone know how to limit Doxygen to > producing complete callergraphs (the entir...

Email on Sales Stage change
I would like to send an email when an opportunity changes sales stages. Any thoughts? Thanks in advance, Loreeta Sorry my mistake, just noticed the Activity button activated. Loreeta "MattNC" wrote: > You can program a Sales Process type workflow. Log in to your CRM server and > open the Workflow Manager. Select the Opportunity entity and on the top right > next to View: select Sales Process, then click the new button back on the > left side. > -- > Matt Wittemann > http://icu-mscrm.blogspot.com > > > "Loreeta" wrote: > > &...

Print format changes when saving as a PDF
Not sure if this is a Publisher question or Adobe question but I have made several flyers in Publisher and when I save them to PDF, the page setup modifications go back to default. Any ideas? What do you mean *back to default*? Are you using a template? You might save the file first and then convert. What version Publisher? Are you using Acrobat? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Joey" <Joey@discussions.microsoft.com> wrote in message news:18CF932A-A885-40AA-9876-7AA84F86C436@microsoft.com... > N...

Changing tooltip text
Hi all, I have a standard toolbar in my application, with tooltips created in the normal way (i.e. string resource with "Status prompt\ntooltip"). The question is, how can I change the text of the tooltips at runtime? Cheers mark-r -- I put ten different puns in my .sig I hoped that at least one of them would make you laugh No pun in ten did Mark Robinson wrote: > The question is, how can I change the text of the tooltips at runtime? Found the solution on CodeGuru! Cheers mark-r -- I put ten different puns in my .sig I hoped that at least one of them would make you la...

when the size of view change,how can I also change size of the font,chart in this view
all: I want to change the size of font and chart go with the view's size changing. what can I do . thx for anyone respone. &best regards. terrcy.j terrcy wrote: > all: > > I want to change the size of font and chart go with the view's size > changing. > > what can I do . > > > thx for anyone respone. > > &best regards. > > terrcy.j > > Handle the WM_SIZE message in the view. It is passed the new size. To change the font you will have to call the CFont's DeleteOjbect, then cal...

conditionally changing colors in a cell
i am trying to change the background color of a cell when a cell example STOP RED SLOW YELLOW GO GREEN STOP =VLOOKUP(A5,LIGHT,2,FALSE) this is my basic stop light when stop is typed into cell a5 i want b5 to change to red, same for slow and go. do i have to use vba? or can this be done as a function? Since you only have 3 condiotns, conditional formatting will work fine .... Format Conditional Formatting Cell Value Is Equal To "Stop" pick red background ... Then Add your two next conditions and colors ... HTH Carim -- Carim ------------------------------------------------...

Filtered form not using query
I have a form that has several subforms on it seperated by the tabs object. Most of the subforms have their data attribute set to SQL, where the data is ordered. One of the subforms has it's data attribute set to a query, where the data is ordered. When I look at the form with it's subform with a filter applied, called from code, the subform with the data set by query does not order it's results. The other subforms are fine! I'm going to try and duplicate this problem, but wondered if anyone had ever heard of such a thing ? Rohan. -- Message posted via AccessMonster.com...

Clear Unbound Text box used as input parameter to query
I've looked at everything I can find, tried all the suggestions but still can't get this to work. I have a form that opens blank. You input your parameter into an unbound text box then press a command button that performs a requery of the database and returns the results in a continuous form. When the results are returned, the parameter is listed as part of the detail in the form so I want the parameter box to be cleared out and ready for the next one. My command on the Search button looks like this: Private Sub SearchEPICode_Click() Me.Requery End Sub ...

How can I change bg color in SDI?
Hi all.. How can I change bg color in SDI? I know that I can do it by handling WM_ERASEBKGND message My code look like this BOOL CSomthingView::OnEraseBkgnd(CDC* pDC) { CBrush br(RGB(127,127,127)); CRect rc; GetClientRect(&rc); pDC->FillSolidRect(&rc,&br); .... .... return TRUE; } But when this code is called.. Windows fliker.. How can I change that code..? What I thought is that I can do it by changing WNDCLASS's hbrBackground But I have no idea how to do it? Is there better way to do it? "EunSub,Kim" <imkimes@verizon.net> wrote > Hi all.. >...

Can contents of a cell be used in header/footer?
All, I am interested in making a custom header that contains text from a certain cell. There are standard fields that can be added to a header or footer using the standard buttons in the header or footer dialog box. These are: &[Page], &[Pages], &[Date], &[Time], &[Path]&[File], &[File], &[Tab] I was wondering if I could create a custom field for my header that would insert the contents of a certain cell. For instance, cell A7 contains a Vendor name, let's say "XYZ Supply". I would like to create a header that says, "Vendor: XYZ Supply&q...

Change the formatting of row by select a single cell & Editing should be working #2
Hi All; I require such a sheet code which can help me in Changing the formatting of row (like A1:A25) of selected cell (A4 is Selected) and allow me to use editing (Cut, Copy, Paste, Undo etc). Currently I'm Using following code but this does not allow me to use editing (Cut, Copy, Paste, Undo etc) and I can not decide the range for working this sheet code. Any kind help is appreciated. Private Sub Search_Click() Sheets("Quick Search").Visible = True ActiveWindow.SelectedSheets.Visible = False Sheets("Quick Search").Select End Sub Private Sub Workshe...

Auto change Caption on Command Bar via formula
Is it possible to have the caption on a Forms.CommandButton change according to a value in a cell? Rob something like this: With Worksheets("Sheet1") .Buttons("button 1").Caption = .Range("a1").Value '.Text??? End With rob nobel wrote: > > Is it possible to have the caption on a Forms.CommandButton change according > to a value in a cell? > Rob -- Dave Peterson ec35720@msn.com Hi Dave, Thanks for this but I can't get it to work. What I've tried is... Private Sub Button1_Click() With Worksheets("Sheet1"...

Transaction Table Column Uses
Does anyone know what the Status column or the ExchangeID column are used for in the RMS Transaction table? I have a few hundred thousand transactions and none of them have a value other than 0 for either of these so I'm thinking they might not be used. I'm I safe to change them for my own uses? More generally, does anyone have a list of the tables/columns and their uses? I know there are unused columns in the item table so it wouldn't surpise me if they were in other tables as well. Thanks. ...

Change form size
I’m having a hard time naming what it is that I want to do so hopefully this will make sense. I have a form that has a logo and two command buttons that take the user to two different forms. I learned how to get this form to open automatically when I open the database but I want it to appear as a box in the center and not full screen in the upper left hand corner. How can I do this...is it in the Properties??? I changed several properties but it's still full screen and not centered. Thanks for any help or suggestions. AccessKay - You might have code in place to ma...

Copying Colored Cells from Excel to Powerpoint
Office 2007: I have several Excel Spreadsheets that have sporatic colored cells. It is not done by conditional formatting. Is there a way to copy these colored cells from Excel to PowerPoint without losing the color shading? Thanks for any help!!! Try setting up a color printer and specifiying it as your default printer. You may need to choose the Paste Options button after you paste -- or use Paste Special on the Home tab to paste as Excel object. If it gets converted to a PPT table, I think you'll lose the conditional formatting. -- Echo [MS PPT MVP] http://www.ec...

Extract XML using Dotnet
Hi Guys, I want to populate a nodelist so that i can extract various details. The xml document i have is similar to the one below. baiscally i want to extract the first instance of <PP> including <PP1> <PP2> <PP3> then separately extract the next instance of <PP> <PP1> <PP2> <PP3>. Does anyone have any examples on how to do this ??? Im trying to create an html table using these values but its a bit of a nightmare. any help appreciated <Text> <Header> </Header> <Details> <PP>LASU</PP> <PP1>A</PP2>...

How to create graphs in a monthly report where the base data can change
Firstly an apology if this has been asked for before, I have looked through but am unable to find anything matching my request. Each month I have to produce a report from our business system. Primarily the report consists of many graphs. I have created a report already that each chart references an individual spreadsheet but the downloading from the business system takes a couple of hours as each data set has to be individually compiled and downloaded. It is possible to download all the data in one go, but I am not sure how I go about then linking the data to each graph. Typically the indivi...

Putting colors on worksheet tabs
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I am trying to use different color worksheet tabs in a rather large, multi-sheet excel file. I used to do it easily in Excel 2004 for PC. Any ideas? Excel 2008 can't do coloured tabs. Maybe next version (2011) will be able to. Cheers On 8/03/10 9:01 AM, in article 59bb44b9.-1@webcrossing.JaKIaxP2ac0, "wrseidel@officeformac.com" <wrseidel@officeformac.com> wrote: > Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel > I am trying to use diffe...

change to the rule could not be saved (out of office)
Hi Guys Ive got a problem when activating an out of office reply in outlook 2003 exchage it reads "changes to the rule could not be saved" There are no rules added in outlook How can I solve this ...

convert to csv using macro gives wrong seperator
Hi, We used to store excel data to a CSV file on our server to be pickup by another program. This is always done with a macro which simply executes a save-to-csv. Since installing Office2007, this macro writes this CSV file with a wrong delimeter. The file is generated with a ',' in stead of a ';' (which is defined). When we save the document as CSV without the macro (manual process) the file is correctly written... any suggestions? Try using the "Local" parameter in your macro (I assume you're using the SaveAs method): ActiveWorkbook.SaveAs Filena...

Change default Contract View to Active instead of Draft
When you are itn eh account view and select the contracts link the default view will show you DRAFT contracts instead of Active Contracts. Since this is a entity that is embedded within an Entity there is no way to modify the default view to show Active. To reproduce what I am reffering to: Open an account record and click on the contracts link, it will show you the Draft contracts and then you have to manually change it to Active contracts with no way to make this default. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the mos...

cannot use ortthografic corrections
In Outlook Express is a possibility to use a check for orthografic faults. It does not work although the settings are adjusted. Please help me! This newsgroup is for support of Outlook 97, 98, 2000 & 2002 from the Office family for Windows PCs. For Outlook Express (OE) support try posting in one of these newsgroups: microsoft.public.inetexplorer.ie4.outlookexpress for OE 4.x microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x http://support.microsoft.com/newsgroups/default.aspx?ICP=GSS3&NewsGroup=microsoft.public.windows.inetexplorer.ie5.outlookexpress&SLCID=US&a...

Change columns in Outlook Address Book
I would like to change the order and/or type of columns in the Outlook GAL. For example, when I browse the Address Book in Outlook 2003, the first column is Name, and the next one is Business Phone, then Office, etc. Can I change the column order? I would like the persons Title to be next to their name. I tried to drag the columns around, but they will not move. ( I saw this on a MS support article) Thanks You need to modify the details template. How to Customize the Details Template https://www.microsoft.com/technet/prodtechnol/exchange/guides/E2k3AdminGuide/b86454bb-3368-4f9c-9...

Excel chart, changing into sections to color
I have a line chart. The user is dividing the chart, manually, with verticle lines. In one section, he wants the chart to be red, in the next section he wants it blue and the third section he wants it yellow. I think it's a neat concept but in trying everything I can think of, I'm not thinking it's possible. The lines color cannot be changed mid-stream. Any thoughts?? Do you want the lines or the background to change color? Here are examples showing in principle how to change colors behind the lines: http://peltiertech.com/Excel/Charts/ChartIndex.html#Background - Jo...

Change how account name appears in Windows Explorer
XP Pro, SP3 Some time ago I used a Dell recovery disk to reinstall XP as I was unable to access the recovery partition. As far as I remember, I only entered: Computer Description: Username's Computer Full Computer Name: Home Workgroup: Workgroup Although the machine is working OK, it has bugged me that when I open Win Explorer I am presented with the following when viewing Documents and Settings: C:\Documents and Settings\(Username).HOME-25XXXXXXXX\My Documents The HOME-25XXXXXXXX reference is that of an old BT Hub (I have used two others since) and is also ...