+ Reply to Thread
Results 1 to 6 of 6

Problems with my macro to sort. It is bringing blank rows to the top.

  1. #1
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Cool Problems with my macro to sort. It is bringing blank rows to the top.

    Hi guys,

    I recorded the following macro:
    Please Login or Register  to view this content.
    There is a problem in the range here I think.
    What is happening is if there is a blank cell between that range, when it is sorted, it brings the blank rows to the top.

    So the GOAL of the macro is to find the last cell with data in the column (in this example column G), select all the cells from the last to the top (to G4), and then sort it out.
    You can find a sample sheet attached explaining very well:
    sample 20-08.xlsm

    Something I cannot understand as well is some cells are not being sorted very well. You can find for example, after sorted, the cells with WHITE written on them, not together with the group of white. Any idea why it happens?

    Thanks folks

  2. #2
    Forum Contributor
    Join Date
    07-28-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Office 365
    Posts
    298

    Re: Problems with my macro to sort. It is bringing blank rows to the top.

    Hi guys

    Anybody can help on that?
    Sounds pretty simple

    Thank you!

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Problems with my macro to sort. It is bringing blank rows to the top.

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Problems with my macro to sort. It is bringing blank rows to the top.

    You can find the last row with data using:
    Please Login or Register  to view this content.
    so your sort would become
    Please Login or Register  to view this content.
    Edit: @ John, that works providing the data always starts in row 1...

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Problems with my macro to sort. It is bringing blank rows to the top.

    Quote Originally Posted by yudlugar View Post
    You can find the last row with data using:
    Please Login or Register  to view this content.
    so your sort would become
    Please Login or Register  to view this content.
    Edit: @ John, that works providing the data always starts in row 1...

    You're right yudlugar. Good catch. Can be modified:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Problems with my macro to sort. It is bringing blank rows to the top.

    Yeah, I think JosephP explained it to me at one point, I think it can be further modified to something like:
    Please Login or Register  to view this content.
    but then you could probably use
    Please Login or Register  to view this content.
    I think there is a reason/certain circumstances where those methods don't always work though.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Bringing up sort command
    By don in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2006, 07:55 PM
  2. How do I create a Macro to sort data and insert blank rows & subto
    By karinmpfa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-25-2006, 05:10 PM
  3. Problems Programming a sort to move rows
    By Jordan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2006, 08:50 AM
  4. Paste by rows and blank cell problems
    By mr starface in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2006, 02:15 PM
  5. Sort Macro to Exclude Blank Rows?
    By ScottPcola in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2006, 03:15 PM

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