+ Reply to Thread
Results 1 to 3 of 3

VBA Sort Mostly Worked, But Not For All Rows

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

    VBA Sort Mostly Worked, But Not For All Rows

    I'm new to using VBA to sort a table, so I'm probably missing something basic . . .

    I'm in the process of creating a spreadsheet to analyze membership data, and the current task I'm working on is to sort the list of meeting attendees by three criteria:
    1. List the organization members first and non-members second ('1' in column 'A' is a member and '0' in column 'A' is a non-member)
    2. Sort the members and non-members by how often person attends meetings (determined by their % meeting attendance, column 'G')
    3. Sort by their last name (determined by column 'C')

    When I modify any cell for a member; e.g., add a meeting location for the month of February, the list resorts immediately and mostly correctly. There are two problems with the sort operation:
    a) The three online attendees with no name (so they are treated as non-members) appear above the members,
    b) The member's last names are sorted in descending order, and the non-member's last names sort in ascending order. I want them both to sort in ascending order.


    The list has headers on row 214 and the data for meeting attendance runs from row 215 to 285. The VBA macro is:
    Please Login or Register  to view this content.

    Yes . . . I know I can make this more sophisticated by only sorting the rows with data, but that is one of several a 'next steps'. Before I 'go there', I want to understand why the sort operation doesn't work properly.
    Last edited by alansidman; 02-19-2019 at 01:10 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: VBA Sort Mostly Worked, But Not For All Rows

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

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

    Re: VBA Sort Mostly Worked, But Not For All Rows

    Thank you for reminding me, and for adding the missing tags. I will re-read the rules and save a copy for future reference.

+ 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. VBA place hours worked on master sheet depending of the date worked in that week
    By guhaseelan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2017, 10:35 AM
  2. [SOLVED] SUMIF worked great, but now data is on separate rows. Need alt. method.
    By Big.Moe in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2017, 09:58 PM
  3. Replies: 0
    Last Post: 01-18-2016, 03:55 PM
  4. [SOLVED] I have a sort macro. How to add script to preselect rows to sort based on column value?
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-09-2014, 02:25 AM
  5. [SOLVED] Rows.Count _Global Failed - When It Worked Before
    By Jrub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 11:42 AM
  6. [SOLVED] Average hours worked based on days worked during a pay cycle
    By jaycee66 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-14-2012, 06:27 PM
  7. A Macro that Copied Rows Which Met a Specific Criteria Worked and Now Errors
    By acer1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2012, 05:51 PM

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