Run code when formula updates.


Board Regular
May 13, 2009
I am using this code to update the cell color in F4:F3000 base on the corresponding value in each case, however because I am using a formula to update the cells containing each case this operation is not functioning only the formula is updating, not the actual value in E4:E3000. Is it possible to write code in VBA to run when the formula updates? Here is the code I am currently using to perform this action manually.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
    If Not Intersect(Target, Range("E4:E3000")) Is Nothing Then
        Select Case Target
          Case "1, 1, 1"
                 icolor = 9
          Case "2, 1, 1"
                 icolor = 11
          Case "2, 2, 2"
                 icolor = 12
          Case "3, 2, 1"
                 icolor = 13
          Case "3, 2, 2"
                 icolor = 14
          Case "3, 3, 2"
                 icolor = 15
          Case "4, 3, 2"
                 icolor = 16
          Case "4, 4, 3"
                 icolor = 17
          Case Else
                 icolor = 18
         End Select
         Target.Offset(ColumnOffset:=1).Interior.ColorIndex = icolor
    End If
End Sub

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...