This shall work too (I started it earlier, but had to leave the office). If there are 2 or more minimal values all will be moved to column I, K, etc.
Mote that moving cells can make your formula referring to column I invalid. To make it independant on moving cells you could either use MIN (you anyway look for lovest value) or INDIRECT function inside your CEILING
Sub test()
Dim arr, i As Long, j As Long, k As Long, startr As Long, startc As Long
Dim minval As Double, helper1, helper2
Application.ScreenUpdating = False
arr = Selection.Value
startr = Selection.Cells(1, 1).Row - 1
startc = Selection.Cells(1, 1).Column - 1
For i = 1 To UBound(arr)
If IsNumeric(arr(i, 1)) And Len(arr(i, 1)) > 0 Then
minval = arr(i, 1)
Else
minval = Application.Max(Selection)
End If
For j = 3 To UBound(arr, 2) - 1 Step 2
If IsNumeric(arr(i, j)) And Len(arr(i, j)) > 0 Then
If arr(i, j) <= minval Then
Cells(startr + i, startc + j).Resize(1, 2).Cut
Cells(startr + i, startc + 1).Resize(1, 2).Insert shift:=xlToRight
minval = arr(i, j)
Application.CutCopyMode = False
End If
End If
Next j, i
Application.ScreenUpdating = True
End Sub
Bookmarks