+ Reply to Thread
Results 1 to 6 of 6

VBA to sort a worksheet by last name

  1. #1
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Tacoma, Washingtonn
    MS-Off Ver
    Excel 2019
    Posts
    254

    VBA to sort a worksheet by last name

    Greetings, I am trying to find a way to instantly short my worksheet. I have a worksheet with data that spans from column A to column T and it continues down to row 525. After the header, the data begins in row 3. The next 325 rows currently have data. I begin entering new names with data at the bottom of the list on a regular basis. When I am done entering the new names, I hope to be able to instantly integrate them into the list alphabetically. Column C is the last name of the person. Is there a way to create a VBA button to do this? Thanks in advance for any help that can be provided.
    Attached Files Attached Files
    Last edited by thedunna; 11-15-2018 at 02:35 PM. Reason: Added a Sample Worksheet

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: VBA to sort a worksheet by last name

    Just select any header to sort


    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Tacoma, Washingtonn
    MS-Off Ver
    Excel 2019
    Posts
    254

    Re: VBA to sort a worksheet by last name

    Leo, thank you very, very much. This was beyond expectations. I was originally looking for a command button that would sort by only one criteria (Last Name) A-Z. This works great though and thanks again.

  4. #4
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Tacoma, Washingtonn
    MS-Off Ver
    Excel 2019
    Posts
    254

    Re: VBA to sort a worksheet by last name

    Leo, you were a tremendous help to me with this sorting issue. I can't thank you enough. I have used it ever since and it works beautifully. I am trying to figure out a way to tweak the sorting function that might work better for me but cannot find a way. I am hoping you can help.

    Using the same sample worksheet, what I would like to do is always sort column A first, then sort by whatever column header I choose. That way the 1's, 2's, 3's, etc... would be sorted first. I am hoping anyone with an "x" in column A would fall to the bottom of the list followed by any blank in column A. I hope this makes some sort of sense. In other words, if I were sorting data manually, I could select two levels of criteria under the sort function. Can this be done with VBA? Thanks for any consideration you can give to this.

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: VBA to sort a worksheet by last name

    Would have been easier start a new thread as this one marked as solved but change
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-19-2012
    Location
    Tacoma, Washingtonn
    MS-Off Ver
    Excel 2019
    Posts
    254

    Re: VBA to sort a worksheet by last name

    Thank you.

+ 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. Replies: 5
    Last Post: 12-16-2015, 02:42 AM
  2. Sort Rows and copy sort results to new worksheet?
    By Apache_sim in forum Excel General
    Replies: 0
    Last Post: 06-30-2015, 03:17 AM
  3. Sort data in a worksheet using an array created from another worksheet
    By IamSierraCharlie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 03:10 AM
  4. Excel 2007 : How to sort a worksheet selection that won't sort
    By crossroadsglass in forum Excel General
    Replies: 0
    Last Post: 02-06-2012, 07:17 PM
  5. Compare,Merge and sort data from differnet Excel worksheet in a new worksheet
    By supratik_pwc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2009, 08:23 AM
  6. Link & automatically sort blank worksheet with Data worksheet
    By alaibubu in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-23-2007, 09:31 AM
  7. automaticaly sort selected contents on worksheet to seperate worksheet
    By fuadramsey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-17-2007, 09:16 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