close

I need to know the highest price I have ever paid for a product. In my
inventory, I update prices monthly, changing the previously recorded price.
If the quot;new pricequot; is more than the price recorded in the quot;high pricequot;
column, I want that price to change to the quot;new Pricequot; amount. I have tried
using the MAX formula in conjunction with the IF formula, but it is not
working properly because if the quot;New Pricequot; is in between the two prices, it
records that quot;new pricequot;. Any suggestions? Note: I am pretty much a novice
at this so please try to keep it simple.

You will need some VBA code.

Right-click on tab name,
Paste following code
Adjust Range(quot;A:Aquot;) to suit your own quot;new pricequot; column (eg: quot;G:Gquot;)
Close VBA

Et voilà!

I reckon it is not as simple as you could expect!

HTH
--
AP

'-----------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim myCell As Range
Set myRange = Intersect(Target, Range(quot;A:Aquot;))
If Not myRange Is Nothing Then
For Each myCell In myRange
With myCell
If .Value gt; .Offset(0, 1).Value Then _
.Offset(0, 1).Value = .Value
End With
Next myCell
End If

End Sub

quot;Lou New At Excelquot; lt;Lou New At gt; a écrit dans
le message de ...
gt; I need to know the highest price I have ever paid for a product. In my
gt; inventory, I update prices monthly, changing the previously recorded
price.
gt; If the quot;new pricequot; is more than the price recorded in the quot;high pricequot;
gt; column, I want that price to change to the quot;new Pricequot; amount. I have
tried
gt; using the MAX formula in conjunction with the IF formula, but it is not
gt; working properly because if the quot;New Pricequot; is in between the two prices,
it
gt; records that quot;new pricequot;. Any suggestions? Note: I am pretty much a
novice
gt; at this so please try to keep it simple.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()