Results 1 to 8 of 8

Sorting with Buttons

Threaded View

  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?

    Sub Sort_Jumper_Symbol()
    
    Dim symb As Range
    Dim entr As Range
    Dim Jump As Range
    Dim srtX As Integer
    
    Set Jump = ActiveSheet.Buttons(Application.Caller).TopLeftCell
    Set symb = Jump.Offset(1, 0)
    Set entr = Jump.Offset(1, 1)
    srtX = Range(Jump.Offset(1, -3), Jump.Offset(1, -3).End(xlDown)).Count
                    'ActiveCell.Offset(0, -10).Select
    'Range(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(1, -1), ActiveSheet.Buttons(Application.Caller).TopLeftCell.Offset(srt, 1)).Sort [G1123], xlAscending, Header:=xlYes
            
    With ActiveSheet.Sort
         .SortFields.Add Key:=Range("JumpSym"), Order:=xlAscending
        .SortFields.Add Key:=Range("JumpEntry"), Order:=xlAscending
         .SetRange Range(Jump.Offset(1, -3), _
            Jump.Offset(srtX + 1, 3))
         .Header = xlNo
         .Apply
    End With
    Jump.Offset(1, 0).Select
       
    End Sub
    Attached Files Attached Files

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