+ Reply to Thread
Results 1 to 4 of 4

Conditional formatting code please

Hybrid View

Cath Conditional formatting code... 08-21-2007, 04:57 AM
Trebor76 Hi Cath, You can actually... 08-21-2007, 05:09 AM
Cath Forgive me, but I am not... 08-21-2007, 06:01 AM
Trebor76 Hi Cath, Any cell can have... 08-21-2007, 06:34 PM
  1. #1
    Registered User
    Join Date
    06-16-2004
    Posts
    7

    Angry Conditional formatting code please

    I have run out of conditonal formatting rules in my spreadsheet and I just need one more that I imagine will need to be coded.......

    If cell H1 is greater than 1 then colour G1 purple (or thereabouts)

    Can someone help please before I have to shell out for a 2007 licence

    Many thanks

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

    You can actually have four criteria in that if you shade the relevant range in the colour you want (purple) as the fourth (last) criteria, then this colour will be returned (defaulted) if the first three criteria aren't met.

    Beyond this, have a look at this code.

    HTH

    Robert

  3. #3
    Registered User
    Join Date
    06-16-2004
    Posts
    7
    Forgive me, but I am not overly good at coding....
    It seems I can colour cells in a specific range if the cell the colour is dependant upon is in that range, but what I want to do is colour the cell next to the one that's value is between 2 To 5

    What I've got so far, which isn't enough:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim icolor As Integer
    
        If Not Intersect(Target, Range("offers")) Is Nothing Then
            Select Case Target
                Case 2 To 5
                    icolor = 55
              
            End Select
            
            Target.Interior.ColorIndex = icolor
        End If
    
    End Sub
    The cell I want to colour is the range "offers" but the cell the colour is dependant upon (i.e. the value 2 To 5) is in a different range....

    Does that make sense?
    Last edited by dominicb; 08-21-2007 at 06:27 AM.

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

    Any cell can have a conditional format that is reliant on the value from any another cell. Have a look at the attached screen shot where this conditional format will work on any cell based on the value in B1.

    You really only need to use code if you have more than four formats.

    HTH

    Robert
    Attached Images Attached Images

+ 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