+ Reply to Thread
Results 1 to 8 of 8

Data bar formatting using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    04-11-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    92

    Data bar formatting using VBA

    Hi Guys,

    I have a column of numbers, both positive and negative, ordered by absolute magnitude from top to bottom. I want to put data bars in the column, with the size of the bar according to the absolute values. However, I want the bars to be coloured red when the number is negative and blue when the number is positve. Any ideas? Im using 2007 version. Thanks!!

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,454

    Re: Data bar formatting using VBA

    Don't think you can do that with data bars, in xl2007.

    You could construct your own via formula and then use CF to colour font.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-11-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Data bar formatting using VBA

    This is what I have now...

    All I want is the data on the data bar cells to show their sign without altering the size of the bars...

    Thanks!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-11-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Data bar formatting using VBA

    Any ideas anyone?

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Data bar formatting using VBA

    as already stated you can't do that in 2007 using data bars. why not use the proposed alternative?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    04-11-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Data bar formatting using VBA

    Well I need the bar on the same cell as the Nominal value, as in my sheet. Can this be done with your solution??

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,454

    Re: Data bar formatting using VBA

    whilst you could combine the formula with another one to output value at the end you will have to compromise on bar and number being the same colour and the value appearing after the bar.

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Data bar formatting using VBA

    you could use a udf to draw shapes instead
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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