+ Reply to Thread
Results 1 to 4 of 4

VBA code to change color of bar chart

  1. #1
    Registered User
    Join Date
    01-02-2012
    Location
    Georgia
    MS-Off Ver
    Excel
    Posts
    36

    VBA code to change color of bar chart

    I am having a difficult time trying to change the color of the bar graph based off the status that chosen. I've been looking at blogs and found that this can possibly be done with a vba code but I am stuck on how to do so. Is there a way a vba code can be created to have the color of the bar change if the status is changed? I have attached an example of the workbook that I am working with.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: VBA code to change color of bar chart

    It took a lot of trial-and-error fumbling around, but I think this will work for you. In the VBA window, in the Project Explorer treeview, double-click Sheet1 (Project Timeline) to open the sheet code window, and copy and paste in the following.

    Please Login or Register  to view this content.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    01-02-2012
    Location
    Georgia
    MS-Off Ver
    Excel
    Posts
    36

    Re: VBA code to change color of bar chart

    OMG thanks so much! It worked perfectly! Do you know if I can have the activities that do not have a status not have a color at all and just let the in progress/pending and completed status be the only one that does?

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: VBA code to change color of bar chart

    The following works if you blank out an existing status, but I'm not sure if it will work when you're creating a new milestone because I don't know what your procedure is for doing that. It may initially appear with the default colors. You'll just have to try it and see. The code I added simulates going into the series format and changing the Marker Fill to No Fill or Solid Fill, and the Line Color to No Line or Solid Line.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] vba code to change the cell color by looking in a range that contains the color index valu
    By ckklconner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2013, 09:15 AM
  2. Change chart color bars VBA code assistance
    By BGiffin2004 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-14-2011, 01:14 PM
  3. Change chart color
    By Pindacko in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-05-2007, 03:36 PM
  4. help me to change the color of two series in a chart into the same
    By KhanhNguyen in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-20-2006, 11:48 PM
  5. [SOLVED] Bar chart: change color of a bar to red if value > x?
    By Christian Münscher in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 09-01-2005, 03:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1