+ Reply to Thread
Results 1 to 7 of 7

Sorting a range in ascending order in a spreadsheet containing headings multiple rows

  1. #1
    Registered User
    Join Date
    09-02-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    Hi, I am new to VBA and been attempting to develop a macro that will sort data for trays for theatre supplies (in ascending order) by Dispatch Date and Time. Each particular item has it's own heading, followed by Unit, Serial no., Dispatch Time. I have managed to get my code to loop through and select each "Unit" and then offset to the start of the data range and select columns B:I and sorting on column I (Dispatch Time). The challenges I am having is that not all the data is sorting correctly on Dispatch Time (some entries seems to get missed in the sort - Dispatch Time is a Date / Time field). Also when selecting the range for rows where the row is either blank or only comprised of one row the sort affects data in the next section. I'm not sure how to get the macro to just sort for rows in the range where the row count is >1, otherwise skip and go to next "Unit". The format columns A to L should remain consistent for data that is exported from our system, but the number of rows in the spreadsheet will vary. Thanks, any help with this would really be appreciated! I have attached a copy of the spreadsheet with the macro, but below is a copy of my macro:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 09-02-2012 at 09:16 AM. Reason: Added code tags

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    It would be nice, if you told us you also posted the same question on an other forum.

    See the link below.

    http://www.mrexcel.com/forum/excel-q...iple-rows.html
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    Thanks oeldere

    Hello vbabeginnerjae, and welcome to the forum.

    Unfortunately you have inadvertently broken two of the forum rules. Please read the following and make the necessary change. Thanks.

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Also

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  4. #4
    Registered User
    Join Date
    09-02-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    Hi Oeldere and Cutter. I am very sorry for this and won't make that mistake again. Sorry to anyone I have inconvenienced, it was unintentional and I understand your reasons for prohibiting this behaviour. I posted the same question here:

    http://excelusergroup.org/forums/p/3445/9991.aspx#9991

    http://www.xtremevbtalk.com/showthread.php?t=324694

    I have had someone kindly help me on another forum with a solution:http://excelusergroup.org/forums/p/3445/9991.aspx#9991

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    Here's a solution from here
    Please Login or Register  to view this content.
    1 for ascending, 2 for descending order

  6. #6
    Registered User
    Join Date
    09-02-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    Hi Jindon, Thanks very much for your help! I really appreciate it.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting a range in ascending order in a spreadsheet containing headings multiple rows

    @vbabeginnerjae

    I'm glad you understand.

    Thanks for the reply.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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