Hi
next go.
Sub aaa()
If Format(Cells(5, 2), "@") > Format(Cells(Cells(Rows.Count, 2).End(xlUp).Row, 2), "@") Then 'new max item
Range("5:5").Copy Destination:=Cells(Rows.Count, 2).End(xlUp).Offset(0, -1)
Range("A5:B5").ClearContents
ElseIf Format(Cells(5, 2), "@") < Format(Cells(6, 2), "@") And Len(Cells(5, 2)) > 0 Then 'new min item
Cells(6, 2).EntireRow.Insert shift:=xlDown
Range("A5:B5").Copy Destination:=Cells(6, 1)
Range("A5:B5").ClearContents
Else
For i = Cells(Rows.Count, 2).End(xlUp).Row To 6 Step -1
If Format(Cells(i, 2), "@") > Format(Cells(5, 2), "@") And Format(Cells(i - 1, 2), "@") < Format(Cells(5, 2), "@") Then
Cells(i, 2).EntireRow.Insert shift:=xlDown
Range("5:5").Copy Destination:=Cells(i, 1)
Range("A5:B5").ClearContents
End If
Next i
End If
Range("A5:B5").Value = Array("New Customer", "0")
End Sub
rylo
Bookmarks