next = 1; for (y = 1; y <= Bottom; y++) { if (pos([5,y], "A-01") > 0) { if (y > next) { MoveRow(y, next); } next++; } }