+ Reply to Thread
Results 1 to 9 of 9

[Q] How can I color code bar in bar graph according to text in adjacent column?

  1. #1
    Registered User
    Join Date
    08-23-2015
    Location
    FL
    MS-Off Ver
    2013
    Posts
    5

    [Q] How can I color code bar in bar graph according to text in adjacent column?

    Hello. Is there a way to color code bars in a bar graph dependent on the text in adjacent column of the data? I'm attaching a spreadsheet with a small example. I'd like the bars to be different color if they belong to vendor A or B and for it to be automated versus manually changes the bars' colors. Thoughts?
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Hi there,

    Take a look at the attached workbook and see if it does what you need. It uses the following code:

    Please Login or Register  to view this content.
    You can change the highlighted values to suit your own worksheet requirements.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-23-2015
    Location
    FL
    MS-Off Ver
    2013
    Posts
    5

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Thank you. This is exactly what I was after; however, I have no idea how to edit macros. I figured out how to add "Developer" tab in Excel but am not sure how to change the red text you noted above besides manually. Is there a simply run down you could provide or a link to a how-to?

    Thnx!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Hi again,

    Many thanks for your feedback.

    Great! At least we're moving in the right direction

    When I talked about changing values, the "manual" method was exactly what I had in mind!

    If you use the Alt+F11 keys it will take you into the Visual Basic Editor where you can change whatever values are appropriate to your new worksheet layout. I'm not sure exactly what you have in mind, but please feel free to ask anything you think I may be able to help you with.

    Best regards,

    Greg M

  5. #5
    Registered User
    Join Date
    08-23-2015
    Location
    FL
    MS-Off Ver
    2013
    Posts
    5

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    I'm pretty good w/ Excel--can even use Solver; however, I know nothing about VBA. I think my idea of manual and yours are different. I'm under the assumption when you are coding you can select cells versus manually typing everything in. Is that correct or did you manually type everything in?

    Also, why is some text blue while others is black?

    I feel completely lost...maybe I need to youtube some videos?

    Thoughts?

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Hi again,

    I typed all of the code "one letter at a time"

    If you're running the Macro Recorder you can select cells manually and their references will be recorded ("typed") in the macro.

    The colours used to display the different elements of the VBA Code are set by the Options >> Editor Format DialogBox of the VBA Editor.

    As far as learning VBA is concerned, I started with extremely small "projects" - enter today's date in Cell A5 - print worksheets 1, 2, 5 and 8 from just one button click - etc. etc. It's much less overpowering than starting on Page 1 of VBA for Dummies and working your way through it. My approach worked for me, but quite possibly not for everyone.

    Feel free to ask if you need any further information.

    Best regards,

    Greg M

  7. #7
    Registered User
    Join Date
    08-23-2015
    Location
    FL
    MS-Off Ver
    2013
    Posts
    5

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Greg,

    Hello. I would really like to use your script but feel like this is over my head. For my use, I would be making new worksheets for different locations and sometimes more vendors than two. So...some of my initial questions are:
    - You set As String = "B12" Do I just input the top cell where the range starts?
    - As String = "Vendor A" Same as above. Do I just put the text of the top cell in the range?
    - Color range (255,0,0) and (0,255,0). What do I do here?

    Frankly, while I'm really rather good at Excel, I don't know the first thing about scripts. My objective is the ability to apply a coloring script to different worksheets within the workbook. I feel a bit lost and like it's too much to ask of you...

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481
    Hi again,

    Never any harm in asking! :-)

    I'm away from home/Excel until the middle of next week - I'll take another look at this when I get home.

    Regards,

    Greg M

  9. #9
    Registered User
    Join Date
    08-23-2015
    Location
    FL
    MS-Off Ver
    2013
    Posts
    5

    Re: [Q] How can I color code bar in bar graph according to text in adjacent column?

    Thank you!

+ 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. Count column value then adjacent column cell fill color
    By MIGARDEIN in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-09-2015, 01:13 AM
  2. [SOLVED] Vba - change column graph color gradients with macro
    By xandermacleod in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-14-2012, 03:05 AM
  3. [SOLVED] Find Specific Text in Text String and Return Value in Adjacent Column
    By watchouse in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 03:53 PM
  4. Coding multiple text in Excel column, return value to adjacent column
    By Tania123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-06-2012, 12:31 PM
  5. [SOLVED] VBA Code Required to autofill formulated column according to the adjacent column
    By bonny24tycoon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-30-2012, 12:05 PM
  6. Graph non-adjacent column data
    By mgia0055 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 09-01-2010, 11:23 AM
  7. change text color based on adjacent cell text color
    By matthewst in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-01-2005, 03:49 PM

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