VBA help needed to highlight cell if value changed by formula

parabamarv

New Member
Joined
Jun 22, 2016
Messages
2
Hi.. I have some urgent requirement of VBA code which will highlight the cell value which contains formula referring to other cell. E.g. If any value get changed in A1 then B1 which has formula (=A1) should get highlighted.
Please suggest a solution on this.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Since the worksheet_change event does not trap changes due to recalculation, this is a workaround that might suit your needs:
The code must be placed on the codepage of the worksheet that contains the cell being tracked.
Code:
Option Explicit
Dim vInitialValue As Variant

Private Sub Worksheet_Activate()
    vInitialValue = Range("B1").Value
    Range("B1").Interior.Color = -4142 'Remove interior color
End Sub

Private Sub Worksheet_Calculate()
    If vInitialValue <> Range("B1").Value Then Range("B1").Interior.Color = vbYellow
End Sub
 
Upvote 0
Thanks for your support. I will check the same & revert.

Since the worksheet_change event does not trap changes due to recalculation, this is a workaround that might suit your needs:
The code must be placed on the codepage of the worksheet that contains the cell being tracked.
Code:
Option Explicit
Dim vInitialValue As Variant

Private Sub Worksheet_Activate()
    vInitialValue = Range("B1").Value
    Range("B1").Interior.Color = -4142 'Remove interior color
End Sub

Private Sub Worksheet_Calculate()
    If vInitialValue <> Range("B1").Value Then Range("B1").Interior.Color = vbYellow
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,689
Members
449,117
Latest member
Aaagu

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