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
Bookmarks