View Single Post
 
Old 09-24-2010, 12:15 PM
tareq tareq is offline Windows 7 Office 2007
Novice
 
Join Date: Sep 2010
Posts: 15
tareq is on a distinguished road
Default

Quote:
Originally Posted by Kimberly View Post
Code:
Sub FixList()
 
Range("A1").Select
 
   Do
    If (ActiveCell.Value > ActiveCell.Offset(0, 1)) Then
 
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
 
     Else:  ActiveCell.Offset(1, 0).Range("A1").Select 
 
        End If
 
       Loop Until IsEmpty(ActiveCell.Offset(0, 1))
 
    End Sub
Be sure to do this on a copy of your worksheet, not the original.
The macro will quit when it encounters a row where col B is empty.
Well, thanks again, you did solve the problem, but I need more than that, attached is an example contains "Before" and "After" sheets that exactly describe the other problem I faced when applying your solution.
Mainly the code you posted didn't allow me to insert an entire row, and when I switch the columns the code didn't work. Please see the attached file and give me your feedback.
P.S. I also updated the example attached in the thread subject.
Attached Files
File Type: xls Example.xls (22.5 KB, 14 views)
Reply With Quote