+ Reply to Thread
Results 1 to 4 of 4

Sort Works for Longer List, but not Current List

  1. #1
    Forum Contributor
    Join Date
    02-01-2019
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    169

    Sort Works for Longer List, but not Current List

    I have a spreadsheet where attendance data is entered on the tab labeled "Input - Meeting Attendance" and, when someone clicks on the tab labeled "Output - Reports", the attendance data is copied from the tab labeled "Input - Meeting Attendance" to the tab labeled "Output - Reports" and then sorted in a useful manner. I noticed that, when the attendance data is entered, some people leave blank lines that would carry forward to the final, sorted report, so I added a sort operation just to remove the blank lines before another sort operation would organize the attendance data in a useful manner.

    The first sort operation is in userform1 and works great if I have a fairly long list of attendees, but if the list is fairly short, then the sort operation doesn't work and I get the error message:
    Untitled.png
    and the debugger highlights the step shown in the following image:
    Code.JPG

    If I copy the attendee list and paste it into the "Input - Meeting Attendance" tab after the existing data (so I double the length of the list of meeting attendees), then the sort operation (and the entire spreadsheet) works properly.

    The question is: Why does the sort operation fail for a short list and what can I do to make the sort operation work for any length list of meeting attendees?

    The spreadsheet is attached to this post.
    Attached Files Attached Files
    Last edited by lovecolorado; 05-13-2019 at 11:18 PM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,374

    Re: Sort Works for Longer List, but not Current List

    Try replacing your faulty code with this...
    Please Login or Register  to view this content.
    Your Sort Key "B1:C1" has no relevance...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    02-01-2019
    Location
    Illinois
    MS-Off Ver
    2016
    Posts
    169

    Re: Sort Works for Longer List, but not Current List

    Thank you. Works great now.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    9,374

    Re: Sort Works for Longer List, but not Current List

    Pleasure...Tx for rep +

+ 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. Data Validation List - Formula to Sort and Return Unique Values in List
    By beewketu in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-14-2015, 04:18 PM
  2. Replies: 2
    Last Post: 03-16-2014, 10:04 AM
  3. Drop Down List (Data Validation) Need to start at current value in list
    By bigmantitus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-07-2014, 11:14 AM
  4. Check current list against Original list and Copy down if incorrect
    By Xiophoid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2013, 04:10 PM
  5. A Custom Sort List Longer Than 255 Characters?
    By minimagician in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2009, 07:09 PM
  6. How do I create a dependent list, to a current list?
    By elevenphil in forum Excel General
    Replies: 1
    Last Post: 01-30-2006, 12:40 PM
  7. Replies: 2
    Last Post: 09-06-2005, 06:05 AM

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