Font and format of listbox values based on condition

  • Hello,


    I have a listbox that lists some items from a spreadsheet, but what I cannot figure out is how to have the font color of the items be RED if the value if negative, and default BLACK when positive...

    Would anyone know how to alter the code to accommodate this?



    Thanks in advance.

  • Re: Font and format of listbox values based on condition


    You can't - not in a standard listbox.


    You might try a ListView which can have individual items in a different colour but this will mean a partial rewrite and a little learning curve as it is a very different control.


    Also, it's not shown in the Toolbox by default. You need to right click the Toolbox, select 'Additional Controls' and select it from the list.

  • Re: Font and format of listbox values based on condition


    cytop,


    I am using excel 2010 64bit - list view does not seem to work in this version from my research...any other options you could see that would work?

  • Re: Font and format of listbox values based on condition


    Unfortunately, no other suggestions. There may be a way to do this but as I don't use the 64 bit version, I don't know.


    That version of Office does seem to be a little lacking in some areas...

  • Re: Font and format of listbox values based on condition


    thank you cytop.


    royuk, i checked out the treeview example, but i don't understand it at all, i am way too novice to create my own solution (i assume this is what it was meant to demonstrate, that you can code your own listview type of control?) thank you for taking the time to answer.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!