Closed Thread
Results 1 to 10 of 10

Changing Cell Colour

  1. #1
    Registered User
    Join Date
    11-21-2006
    Posts
    8

    Changing Cell Colour

    I am trying to get cells to change to a preset colour when a particular 3 digit code is entered. I can get 3 colours using conditional formatting but need to have 6. Is this possible using another formula?? Can anyone help.

    Cheers

    Jez

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    This post should help

    http://www.mrexcel.com/archive/Formatting/12054.html

    or

    http://www.vbaexpress.com/kb/getarticle.php?kb_id=90

    It needs VBA code so you will need to entry in VB editor. See attahced for info

    http://www.contextures.com/xlvba01.html

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    With VBA, you can have multiple conditions and multiple colors ...
    you are no longer limited to the 3 conditions of standard conditional formatting

    see attached

    HTH
    Carim
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-21-2006
    Posts
    8
    Thanks for the help so far. If I want to specify colours for 6 3 letter codes (LTH, MBA, RKE, AHO, BGL, DHO) who do i go about altering the code as yours is set to 26 single letters as I'm not sure how to get the table ref in. See attached exmaple.

    Cheers

    Jez
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-08-2006
    Posts
    30
    hey guys....
    i wanna ask something which relates to this particular thread...
    the example codes and worksheets that you guys posted, i havea question regarding that. I can't seem to get mine working, cause i don't raelly know how to automatically assign it to my worksheet,i.e. do i need to setup a button or a command switch ?

    regarding the respective colour index, do you may have a list of all the colours ?

    thanks in advance
    cheers guys

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Add the code to the sheet you want the changes to happen in e.g Sheet 1 . See attached link

    http://www.contextures.com/xlvba01.html#Worksheet

    VBA Noob

  7. #7
    Registered User
    Join Date
    11-08-2006
    Posts
    30
    Quote Originally Posted by VBA Noob
    Hi,

    Add the code to the sheet you want the changes to happen in e.g Sheet 1 . See attached link

    http://www.contextures.com/xlvba01.html#Worksheet

    VBA Noob
    hey VBA Noob...

    thanks for the reply, but it still won't run. do i have to activate anything ? cause i followed the guide from the link, still stuck

    cheers

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Explain what you've done then or post an example

    VBA Noob

  9. #9
    Registered User
    Join Date
    11-08-2006
    Posts
    30
    i did exactly what the guide says...

    1.Copy the code that you want to use
    2.Select the worksheet in which you the code to run
    3.Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
    4.Where the cursor is flashing, choose Edit | Paste

    what am i suppose to do after that ?

    cheers


    edit: found out what went wrong in my request....everything's a-okay now, thanks a whole bunch

    cheers
    Last edited by EddyAddelan; 12-06-2006 at 08:09 AM.

  10. #10
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329
    Hello.

    I have tried the routine and it works. I have a problem with one of it's features though.
    Please Login or Register  to view this content.

    I want to compare the values to in the target range to a cell D3 in another sheet called "Settings". How can I do that? The value in cell D3 is "705".
    I also want be able to format the target range in case I write "OK" in the target range.
    What I can see in this code is that it only accepts integer values? How can I change it so that it accepts any kind of values?

    /Anders

Closed Thread

Thread Information

Users Browsing this Thread

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

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