Results 1 to 3 of 3

Ignore Blanks In Data Sort

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Ignore Blanks In Data Sort

    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.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1