Changing a cell if its value is not as great as another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Say i have two cells, A1 is dynamic. In A2 i want the maximum value whic
hever appears in A1. For example if A1 becomes 10, and then drops to 5, i
want A2 to display 10 until the value becomes greater than ten.
 
One way. right click sheet tab>view code>insert this.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
If Range("a1") > Range("a2") Then Range("a2") = Range("a1")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top