+ Reply to Thread
Results 1 to 3 of 3

Userform listbox sort columns by clicking on header

  1. #1
    Registered User
    Join Date
    03-05-2008
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    56

    Userform listbox sort columns by clicking on header

    Hi,

    I have posted this same question on Microsoft's Q&A, but not getting any response, could be the wrong place to ask, so asking here as well.

    https://docs.microsoft.com/en-us/ans...-on-heade.html

    In Excel vba, I have a listbox in a Userform and would like to sort the column when a column header is clicked. Is this possible?
    So, if I click on column 6 header then it will arrange all the columns by column 6 alphabetically, and then if I clicked column 6 again then it would reverse the order.

    126086-image.png

    Thanks
    ST

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Userform listbox sort columns by clicking on header

    As far as I am aware from my experience you can not sort the actual listbox.
    What you need to do is have someway of selecting the column (possibly with option buttons) and selecting type of sort.
    This would most likely require a series of Select Case statements to cover all likely combinations required.
    This would then sort the sheet and re-load the listbox.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    03-05-2008
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    56

    Re: Userform listbox sort columns by clicking on header

    Thanks very much Torachan, that's given me an idea to work on

+ 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. [SOLVED] Sort for multicolumn listbox in userform (5-columns)
    By d.sanchez in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-11-2017, 05:30 AM
  2. [SOLVED] Input Filtered DataBase into Userform Listbox by clicking cmd
    By brainzlp in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-07-2016, 01:27 PM
  3. How to Sort Columns by Clicking on Column Header
    By hwhip in forum Excel General
    Replies: 2
    Last Post: 03-06-2014, 05:29 AM
  4. How to Sort Columns by Clicking on Column Header
    By hwhip in forum Excel General
    Replies: 4
    Last Post: 03-05-2014, 01:02 PM
  5. Transfer Data From One Userform Listbox to Another Userform Listbox with 11 columns
    By sparkoft in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-18-2013, 10:54 AM
  6. Code to Sort Data by Clicking on Header Row Cells
    By Coop913 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-07-2009, 01:24 PM
  7. Replies: 3
    Last Post: 05-17-2009, 04:31 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