+ Reply to Thread
Results 1 to 5 of 5

v2003 more than 3 conditions- colors

Hybrid View

  1. #1
    Registered User
    Join Date
    05-26-2010
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2003
    Posts
    52

    v2003 more than 3 conditions- colors

    hello all,

    I am wanting all cells in range:G18-AC53 with the number 1 to be red,with number 2 to be pink, number 3 to be green, number 4 to be yellow and number 5 to be black. Only in one sheet called test of a workbook with 5 sheets. Is this possible?

    Is

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: v2003 more than 3 conditions- colors

    Hi there,

    Try this Worksheet_Change event macro*

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Range("G18:AC53")) Is Nothing Then
            With Target
                Select Case .Value
                    Case 1
                        .Interior.Color = RGB(255, 0, 0) 'Red
                    Case 2
                        .Interior.Color = RGB(255, 0, 255) 'Pink
                    Case 3
                        .Interior.Color = RGB(0, 255, 0) 'Green
                    Case 4
                        .Interior.Color = RGB(255, 255, 0) 'Yellow
                    Case 5
                        .Interior.Color = RGB(0, 0, 0) 'Black
                End Select
            End With
        End If
    
    End Sub
    * To install and subsequently modify this macro, follow these four steps:

    1. Copy my code to the clipboard Ctrl + C
    2. Right-click on the tab you wish the code to run on and from the shortcut menu select View Code
    3. Paste Ctrl + V my code from step 1 into the blank module
    4. From the File menu click Close and Return to Microsoft Excel

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    05-26-2010
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2003
    Posts
    52

    Re: v2003 more than 3 conditions- colors

    thank you!!!
    exactly what i wanted

    I really appreciate it

    Is
    Last edited by Paul; 11-14-2010 at 02:49 AM. Reason: Removed quote of full post

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: v2003 more than 3 conditions- colors

    Isabella, in the future please do not cross-post without providing a link to the other post(s). In this instance, two people worked on a solution for you, and one ended up wasting time as a solution was provided elsewhere.

    Future cross-posts without links will be closed.

    http://www.mrexcel.com/forum/showthread.php?t=508424

    Please review the forum rules, for which there is a link in my signature below.

  5. #5
    Registered User
    Join Date
    05-26-2010
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2003
    Posts
    52

    Re: v2003 more than 3 conditions- colors

    Hi Paul,

    Yes it was my mistake, i was posting from my parents house and had both urls open, couldnt find the post, thought it hadnt worked and resent it - then realised a few hours later it was on 2 different urls...

    apologies
    Is

+ Reply to 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