Run code when formula updates.

dhosi439

Board Regular
Joined
May 13, 2009
Messages
62
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.

Code:
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
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,214,963
Messages
6,122,484
Members
449,088
Latest member
Melvetica

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top