VBA code highlights cell when formula value in the cell changes

  • I have a VBA code that highlights any cells when the formula value in the cell changes in value between a range. I close the workbook. I then open the workbook but now any cell that has a value in my range will become highlighted. I don't want this to happen. I only want the cells that are highlighted prior to closing the workbook to stay highlighted.


    Now, how do I keep these highlights on my worksheet?


    Seeking your VBA expertise!

  • Re: VBA code highlights cell when formula value in the cell changes


    I have three codes in different places. See below.


    Standard module

  • Re: VBA code highlights cell when formula value in the cell changes


    When the workbook opens, it will calculate the cells automatically - this in turn, will fire the "Worksheet_Calculate" Event which is probably mapping the whole opening event as a change. Have you tried using the "Worksheet_Change" event instead? I think this could be used more effectively for what you need and the Event wouldn't be fired when the workbook opens.


    Even though you have the calculation mode defined in the Workbook_Open event, I'm pretty sure Excel does the opening calculations before it fires this event anyway. I might be wrong though.

  • Re: VBA code highlights cell when formula value in the cell changes


    I need the worksheet calculate event because my file has vlookups to a source file. Worksheet change event will not highlight these vlookup reference cells when the formula values change; only when changes are entered manually. Right? How would I go about adding a worksheet change event to this code to prevent the code from highlighting any cell that contains a value in my range?

  • Re: VBA code highlights cell when formula value in the cell changes


    The formula value I am talking about refers to the value in the cell that is produced from a formula change. I was thinking...can I just use conditional formatting to highlight cells yellow whenever the cell that is produced from a formula changes?

  • Re: VBA code highlights cell when formula value in the cell changes


    i'll look into this more. hopefully someone can assist.


    Quote from pike;710407

    Hello,
    its just one off those things.. threr is a difference between manually changing a cells value and formula changing a cells value..one is triggered the other just happens

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!