Worksheet_Change when the value of a formula changes

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
189
Hi all,

I have a code that runs when cells are changed in my spreadsheet

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Not Intersect(Target, Range("B10:H5010")) Is Nothing Then Target.Interior.Color = rgbYellow
End Sub

However some of the cells are formula cells and these don't get their colour changed when the value returned by the formula changes (e.g. when a date is recalculated).


Is there any way around this?

Thanks
Tom
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try using the worksheet_calculate event rather than the worksheet_change event.
 
Upvote 0
Hi JoeMo, I can't figure out how to get this worksheet calculate event to work with my code.

I have a range of cells that I want to see if any of the calculations change in that particular cell and then change the colour only of that cell.


Regards
Tom
 
Upvote 0
Sounds like you need to focus on worksheet_change events for the precedent cells of the formulaic cells you wish to monitor. Precedent cell(s) would be the one(s) that hold constants (not formulas) and the user would change manually. For example, suppose A1 holds the formula: =IF(B1="","",B1). If a user enters or changes text or a number in B1, cell A1 will change, but the change event you want to monitor is the one for B1. In the change_event code you can then change the fill color of A1 whenever the content of B1 is changed.
 
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,603
Members
452,658
Latest member
GStorm

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