+ Reply to Thread
Results 1 to 8 of 8

Sorting with Buttons

  1. #1
    Registered User
    Join Date
    03-22-2019
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2016
    Posts
    58

    Sorting with Buttons

    I'm having an issue with the VBA Sort function when using a button to activate the Sort. The code seems to work one time when I first try it, but then does not work after that.

    Columns A-G need to be sorted based on data in column D for "Symbol" button, or column E for "Entry Date" button. I am using cell names to indicate location as this "Jumper" section will move down the sheet as more records are added above. (and columns B & C are blank and need to remain blank)

    Here is the code that is not working, and I have attached a stripped down version of the document. The macros in question are entitled "Sort_Jumper_Symbol" and "Sort_Jumper_Entry".

    What am I doing wrong?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    536

    Re: Sorting with Buttons

    I don't know if I understood you correctly.
    In my solution, all cells in the B: G range must be unmerged.
    I used helper column 'J' for sorting.
    Sorting for "Symbol".
    Please Login or Register  to view this content.
    Sorting for "Entry Date".
    Please Login or Register  to view this content.
    Best Regards,
    Maras.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Sorting with Buttons

    Hello jeffcp66,

    I made a few changes to your macro and this version worked for me.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    03-22-2019
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2016
    Posts
    58

    Re: Sorting with Buttons

    Thanks Leith! That is sorting correctly, but it is only sorting columns D-G. I need A-G sorted, but can't figure how to adjust your code to do that.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Sorting with Buttons

    Hello jeffcp66,

    Here is the amended macro code to include columns "A:G".

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-22-2019
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2016
    Posts
    58

    Re: Sorting with Buttons

    That's not working, I get "Run-time error '1004': The sort reference is not valid. Make sure that it's within the data you want to sort, and the first Sort By box isn't the same or blank." When I click "Debug" it highlights the code line ".Apply"

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Sorting with Buttons

    Hello jeffcp66,

    I was out most of the day on other jobs. Here is the amended macro code...

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-22-2019
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2016
    Posts
    58

    Re: Sorting with Buttons

    Thanks, it works now!

+ 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. Macros with buttons, spin buttons, scroll buttons, etc.
    By qqbbppdd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2013, 09:34 AM
  2. How to set buttons for sorting if there are already fileters?
    By toplisek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2013, 07:13 AM
  3. enable certain combo buttons based on user selected option buttons
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-20-2013, 06:43 AM
  4. How to insert and user of Buttons, Radio buttons, check boxes in excel sheet.
    By krishco in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 02:52 AM
  5. How to insert Buttons, radio buttons and check boxes in Excel
    By krishco in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2013, 08:13 AM
  6. How can I insert multiple sets of option buttons (radio buttons) in Excel 2010?
    By mickwooduclan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2013, 10:01 AM
  7. [SOLVED] Option Buttons-putting questionaire using options buttons
    By Ashman in forum Excel General
    Replies: 2
    Last Post: 07-10-2005, 04:05 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