I want a simple color code on quite a large spreadsheet (several hundreds cells to color). If I use CF it slows the computer and Excel just crashes. I want to try and do it with VBA. I tried the below code but it only works if I type the value (being 1, 2 or 3). It doesn't work if the value if the result of a formula. Any idea?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icol As Integer, c As Range, rng As Range
If Target.Count > 1 Then Exit Sub
Set rng = Range("D2:s1000")
If Intersect(Target, rng) Is Nothing Then Exit Sub
For Each c In Intersect(Target, rng)
Select Case UCase(c.Value)
Case 1: icol = 3
Case 2: icol = 4
Case 3: icol = 18
Case Else: icol = 0
End Select
c.Interior.ColorIndex = icol
Next c
End Sub
If Jean Francois Corbett could answer that would be great!