We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Colour coding text in Excel

Options
I wonder if anyone can help on this. I'm trying to colour code text in a column so that when I enter say a three letter text string in a cell Excel automatically gives it a predefined colour.
I've tried conditional formatting and can get three colours this way plus the plain black for text which is not formatted, i.e. four colours in total. But I need up to 10 colours.
Is there any way to do this? Maybe there's an online resource which explains it. I tried a Google search and couldn't find anything. I'm little more than a novice with Excel so please explain in simple terms.
Thanks in advance.

Comments

  • jonnyb
    jonnyb Posts: 600 Forumite
    Part of the Furniture 500 Posts Combo Breaker
    just looked at my excel and conditional formatting allows me to use the whole colour palette.
    what version excel you got ? I have 2000.
    Karma is a wonderful thing. ;)
  • AndyRat
    AndyRat Posts: 98 Forumite
    Part of the Furniture 10 Posts Combo Breaker
    I seem to remember away of doing this advertised on the ozgrid.com website a couple of months back

    HTH
  • jonnyb
    jonnyb Posts: 600 Forumite
    Part of the Furniture 500 Posts Combo Breaker
    sorry - just checked again. I realise the limitation is that excel only allows each cell to have up to 3 conditions set.
    Karma is a wonderful thing. ;)
  • cwoodham
    cwoodham Posts: 432 Forumite
    johnnyb, I've Excel 2000. I can select from the whole palette okay, its just that conditional formatting only seems to allow three 'picks' from the palette.
  • cwoodham
    cwoodham Posts: 432 Forumite
    AndyRat: Thanks. I went to the ozgrid.com website and got some help here

    http://www.ozgrid.com/VBA/excel-conditional-formatting-limit.htm

    I copied the VBA code into the codes window of the worksheet as instructed and put in the text I wanted instead of Case and I was able to change the cell background colours conditionally, which is a good result!
    I guess if I knew more about VBA I could change the font colours but this will do in the meantime.
  • You're nearly there, a quick search on google for "Excel VBA font colour" returned a number of pages, the second one said this...

    "ActiveCell.Font.Color = RGB(255,0,0)
    sets the active cells font colour to Red (255 red, 0 green, 0 blue). Alternatively, you can use the ColorIndex property. This lets you specify an item in the workbooks palette (this can be set in the Color tab of the Excel Options dialog).

    ActiveCell.Font.ColorIndex = 16

    sets the font colour to the 16th item on the colour palette."

    So you're looking at replacing interior.colorIndex with font.colorIndex

    (or you can use RGB values with the first string)

    Hope this sorts your problem

    E.M.
  • cwoodham wrote:
    I guess if I knew more about VBA I could change the font colours but this will do in the meantime.
    The best way of finding out how to perform an action in VBA is by using the macro recorder (Tools - Macro - Record New Macro). With the recorder running, perform the action as normal via the keyboard, mouse and menus and then click the 'Stop recording' button and open the VBA editor to see the results. The code can be a bit bloated and not the most efficient, but it's a good starting point.
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 351K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.6K Spending & Discounts
  • 244K Work, Benefits & Business
  • 598.9K Mortgages, Homes & Bills
  • 176.9K Life & Family
  • 257.3K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.