View Single Post
Old 09-07-2011, 02:33 AM
Catalin.B Catalin.B is offline Windows Vista Office 2007
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road

Try this code:
Sub Macro2()
Dim i As Integer
With ActiveSheet

For i = 2 To 25
Range("E" & i).Value = Range("B" & i).Value

    Next i
    End With
    With ActiveSheet
    For i = 2 To 25
    If Range("E" & i + 1).Value > Range("E" & i).Value Then
Range("E" & i + 1).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

    End If
    i = i + 1
    Next i
    End With
End Sub
If you have a long range, you may disable screen updating to speed up macro...
Attached Files
File Type: xlsm test spaces in col.xlsm (15.2 KB, 8 views)
Reply With Quote