|I have the following macro to act on the above data: |
If Range("B1").Value <> Range("B2").Value Then
Range("D1").Value = Range("C1").Value
A new row 1 is added periodically by "insertion" - move rows down. The objective is for the value in cell D2 to remain the same as long as B1 and B2 are equal but to take on the value of C1 when an added new row causes B1 and B2 to no longer be equal. The macro worked just fine when the values in B1 changed from 0 to 379.265, the proper value of $2241.45 being displayed in D2 and remained that value while the next several lines were added. However, when the row was added that caused the value of B1 to change from 379.265 to 381.611, the value in D1 did not change. It remained $2241.45. It should have changed to $2224.79. Can someone tell me why the macro worked properly when B1 changed from 0 to 379.265 but did not work when it changed from 379.265 to 381.611? Please offer a suggestion to correct the problem.