Results 1 to 10 of 10

55 x conditions for Conditional formatting with a twist

Threaded View

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    6

    55 x conditions for Conditional formatting with a twist

    What I am trying to do is to lookup the values in Column C and then to fill the background colours in the >0 values in the matching row of columns (v:BX).

    The numbers in Column C range from 1 to 55 and I require a unique colour for each number in the range (V:BX) which has many blanks inbetween numbers on the same row.

    I tried the following the VB below I picked up from a friend, but I tried to adapt it using a range offset but this just coloured the entire range of (V:BX)

    I also tried to write a function in VB but I am not that proefficient in VB and failed.

    Any help is very appreciated.

    Thanks


    Private Sub Worksheet_Change(ByVal Target As Range)
    Set color = Range("C6:C1000")
    For Each Cell In color
    
    If Cell.Value = 1 Then
    Cell.Interior.ColorIndex = 2
    End If
    
    If Cell.Value = 2 Then
    Cell.Interior.ColorIndex = 3
    End If
    
    If Cell.Value = 3 Then
    Cell.Interior.ColorIndex = 4
    End If
    
    If Cell.Value = 4 Then
    Cell.Interior.ColorIndex = 5
    End If
    
    If Cell.Value <> 1 And Cell.Value <> 2 And Cell.Value <> 3 And Cell.Value <> 4 Then
    Cell.Interior.ColorIndex = xlNone
    End If
    
    Next
    End Sub
    Last edited by zbor; 09-28-2012 at 08:12 AM.

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