1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub test()
Dim c As Range
With Sheets("objet")
.[B2:D1000].ClearContents
For Each c In .Range([A2], .Cells(.Rows.Count, 1).End(xlUp))
If Application.CountA(.Range(.Cells(c.Row, 6), _
.Cells(c.Row, .Columns.Count).End(xlToLeft))) > 0 Then
c.Offset(, 1).Value = Application.Average(.Range(.Cells(c.Row, 6), _
.Cells(c.Row, .Columns.Count).End(xlToLeft)))
c.Offset(, 2).Value = IIf(c.Offset(, 1).Value >= 0, c.Offset(, 1).Value * 1.1, c.Offset(, 1).Value * 0.9)
c.Offset(, 3).Value = IIf(c.Offset(, 1).Value < 0, c.Offset(, 1).Value * 1.1, c.Offset(, 1).Value * 0.9)
If Application.Max(.Range(.Cells(c.Row, 6), _
.Cells(c.Row, .Columns.Count).End(xlToLeft))) > c.Offset(, 2).Value Or _
Application.Min(.Range(.Cells(c.Row, 6), _
.Cells(c.Row, .Columns.Count).End(xlToLeft))) < c.Offset(, 3).Value Then
c.Offset(, 4).Value = "pas correct"
Else
c.Offset(, 4).Value = "prix correct"
End If
End If
Next c
End With
End Sub |
Partager