+ Reply to Thread
Results 1 to 10 of 10

55 x conditions for Conditional formatting with a twist

  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


    Please Login or Register  to view this content.
    Last edited by zbor; 09-28-2012 at 08:12 AM.

  2. #2
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Exclamation Re: 55 x conditions for Conditional formatting with a twist

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)

     
    On Error Resume Next
     
    If Not Intersect(TargetRange("C6:C1000")) Is Nothing Then
         Target
    .Interior.ColorIndex Target.Value 1
     End 
    If

    End Sub 

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: 55 x conditions for Conditional formatting with a twist

    Kosh, I did it now for you but in future please use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: 55 x conditions for Conditional formatting with a twist

    hi kosh, if I understood you correctly you need to have as a result coloured cells having value >0 and each cell within each row from 1 to 55 must have different colour. Please check sample file if it's of any help to you/ Press Run button. That's only colouring part with no condition set for C column.
    Attached Files Attached Files

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

    Re: 55 x conditions for Conditional formatting with a twist

    Hi sorry actually I need the colour to fill into the row not the column.

    eg if cell C6 is value 2 then rows V6:BX6 need to be filled in the unique background colour corresponding to the 2 value missing any cells in between cells V6 to BX 6 which are blank or 0

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: 55 x conditions for Conditional formatting with a twist

    please check attachment, press Run button
    Attached Files Attached Files

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

    Re: 55 x conditions for Conditional formatting with a twist

    Thank you so much!!! Thats perfect!

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

    Re: 55 x conditions for Conditional formatting with a twist

    Hi I have a quick question about trying to extend this range of 55 to 200 rows of individual colours. I was wondering how this would be possible seeing as Excel only has 56 colour index values...many Thanks

  9. #9
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: 55 x conditions for Conditional formatting with a twist

    What do you need so many colors for ? Spreadsheets are not really designed for imitating Picasso !

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: 55 x conditions for Conditional formatting with a twist

    the problem that you may encounter is that you might have equal color to your eye but in reality it is of different shade in red or whatever

+ 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