I have the following code to sort a table of 3 columns (B2:D157) into A-Z order by the middle column (Column C).
Sub sort_name()
'
' sort_name Macro
Range("B2:D2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("C2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C115").Select
ActiveWindow.LargeScroll Down:=-1
Range("C65").Select
ActiveWindow.LargeScroll Down:=-1
Range("C15").Select
ActiveWindow.LargeScroll Down:=-1
Range("B2").Select
End Sub
My problem is that many of the cells are empty and these empty cells are going to the top of the table when i run the macro. Instead, i want all the empty cells to stay below the cells with data.
Attached is a copy as an example.
Bookmarks