Hello,
The procedure below is a loop designed to test a value in the selected range / cell against a value in the same row two columns to the right. If the selected cell’s value is less than the value in the column two to the right and the value in the cell fifteen to the right is greater than that in the cell sixteen to the right of the selected cell then a value in the cell one to the right of the selected cell is copied to another worksheet.
The part of the statement (underlined) is not doing what it should. If the value in the selected cell is equal to the cell two to the right it is still copying the value ( one to the right of the selected cell) to the other worksheet. It is as if the code is being read as <= instead of <.
Please will someone show me where I am going wrong.
Code:
[LEFT][LEFT]Sub Assesment1()
Sheets("StockAssesment").Select
Range("g7").Select
Do Until IsEmpty(Selection)
If [U]Selection.Value < Selection.Offset(0, 2)[/U].Value And Selection.Offset(0, 15) > Selection.Offset(0, 16) Then _
Selection.Offset(0, 1).Copy Destination:=Sheets("StockAssessmentList").Range("b:b").Cells(Rows.Count).End(xlUp).Offset(1, 0)
Selection.Offset(1, 0).Select
Loop
End Sub[/LEFT]
[/LEFT]
Any help will be much appreciated.
Thank you .
Rob.