BrotherMan
11-08-2007, 10:28 PM
Column A is filled with n number of restaurants.
Column B is filled with an equal number of =rand().
Column C has five cells, C1 = A1, C2 = A2 and so on.
I can manually sort by Column B, being sure to select the "No Header row" radial.
The macro to do this:
Columns("A:B").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Works okay, except once in a while it gets wonky on me and leaves A1 the same item no matter what the rand() is. At this point, reverting to the manual sort can fix it. But it will eventually revert to using row 1 as header space.
Is there a kind and compassionate codemonkey that can see anything obvious?
Column B is filled with an equal number of =rand().
Column C has five cells, C1 = A1, C2 = A2 and so on.
I can manually sort by Column B, being sure to select the "No Header row" radial.
The macro to do this:
Columns("A:B").Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Works okay, except once in a while it gets wonky on me and leaves A1 the same item no matter what the rand() is. At this point, reverting to the manual sort can fix it. But it will eventually revert to using row 1 as header space.
Is there a kind and compassionate codemonkey that can see anything obvious?