sts8500man
Board Regular
- Joined
- Jul 12, 2012
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
A | B | C | D | ||||||
1 | 381.611 | $2,224.79 | $2,241.45 | ||||||
2 | 381.611 | $2,232.42 | |||||||
3 | 381.611 | $2,232.42 | |||||||
4 | 379.265 | $2,241.45 | |||||||
5 | 379.265 | $2,241.45 | |||||||
6 | 379.265 | $2,237.66 | |||||||
7 | 379.265 | $2,237.66 | |||||||
8 | 379.265 | $2,241.45 | |||||||
9 | $0.00 | ||||||||
10 | |||||||||
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 End If End Sub 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. | |||||||||
<tbody>
</tbody>
Last edited: