+ Reply to Thread
Results 1 to 3 of 3

Ignore Blanks In Data Sort

  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).

    Please Login or Register  to view this content.
    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

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

    Re: Ignore Blanks In Data Sort

    not too sure why but i don't think you can run the macro with the button but if you go into the macros you should at least be able to run it from there.

    Thanks,
    Adam.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Ignore Blanks In Data Sort

    1) You didn't connect the macro to the button, so no worries there, easy fix, yes?

    2) Your column C "empty" cells aren't really empty, are they? Some sort of null characters in there? Do you know why that is? If you can simply clear those cells properly, the issue goes away.

    3) I have added a routine to the beginning of this macro to sift through your column C values and remove these weird null values, then do your sort.

    Please Login or Register  to view this content.
    The macro is fine to use, but it's really best to analyze your work process and see if you can spot where the weird null values are being added into your sheets and try and solve it from there.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

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