VBA only fire on second entry in cell

  • I have a strange question tbh I'm not even sure if it is possible.


    Is there a way to add code into a worksheet_calculate event that stops the code firing on the first entry and only the second.


    I have a range that has an old value change that offsets the old value by one column and I have a reset macro that clears the old value.


    My issue is I have another sheet that has the difference between the new value and old value i.e. A1-B1 however because the old value is always zero after first entry the difference is always just the new value.


    Ideally I would like the code to only fire if the values are changed after the first entry is made.


    Again I don't even know if this is possible :lol:

  • Re: VBA only fire on second entry in cell


    You could include in your macro a check of the cell contents for ZERO. If it is ZERO, EXIT SUB.


    Would that work for your purposes ?

  • Re: VBA only fire on second entry in cell


    I never thought of that yes that could work!


    How would i implement that into this code?



    Thanks

  • Re: VBA only fire on second entry in cell


    .
    What cell are you checking for the old value ? G8 ??
    If it is G8 :


  • Re: VBA only fire on second entry in cell


    The ranges that i require to offset are G8:G130, I8:I130, K8:K130


    is this still possible if i change the range in your code to mirror my range in the existing code?

  • Re: VBA only fire on second entry in cell


    .
    Try:


    Code
    If Range("G8").Value <> 0 Then
        With Range("G8:G130, I8:I130, K8:K130")

Participate now!

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