+ Reply to Thread
Results 1 to 14 of 14

Listbox Multiselect

  1. #1
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Listbox Multiselect

    Hello expert,

    I have 2 Listboxs (txtActionby & Listbox1), i would like to do a multiselect in txtActionby separated by comma and will be displayed in the Listbox1 once the Add button is pressed.
    And whenever i want to update the data, the previous multiselected person separated by comma will be highlighted in the txtActionby. How can i do that ? i Appreaciate all your help. Thanks in advance
    Attachment 748037

  2. #2
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    Any expert ? I come in peace and seek for help.
    Last edited by Cyril Beki; 09-18-2021 at 06:12 AM.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Listbox Multiselect

    You will get help as and when someone is ready to help, and that help will be offered for free.

    Any expert ? I come in peace and seek for help.

    "Part of being a person is about helping others"
    -Regis Murayi-
    Making quotes about helping others on a forum where many members spend a lot of their free time doing just that shows us two things:

    1. You don't know how the forum works.
    2. You have an impatient streak.

    I think that last post is likely to do your chances of getting help more harm than good, I hope for your sake that I am wrong.
    Last edited by AliGW; 09-18-2021 at 07:09 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Listbox Multiselect

    First you need to set your listbox to be multi select.
    Either set the property at design time or add code to userform Initialize event
    Please Login or Register  to view this content.
    then you need to loop through and check choices. Modify Add event code
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    Attachment 748204

    Hello Andy Pope,
    thank you for replying, i do like you said but still get an error when i click on the add button (refer image)
    and whenever i double click on the listbox1 for updating purpose, it going to this code Call MsgBox("Pilih data pada tabel data", vbInformation, "Data Siswa")
    Last edited by AliGW; 09-18-2021 at 09:43 AM. Reason: PLEASE don't quote unnecessarily!

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Listbox Multiselect

    Please don't quote previous reply, unless it has a use. Otherwise it just clutters your post.

    Please Login or Register  to view this content.
    Your example workbook does not load any values in to any controls so difficult to actual test.

    You will need to check the double click event of the control to see what code is being run

  7. #7
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    Hello andy pope, the value in txtActionby is depend on combobox (txtSection). Pick diffusion and it will load the value inside txtActionby

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Listbox Multiselect

    Administrative Note:

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on at least TWO other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)

  9. #9
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30
    Last edited by Cyril Beki; 09-18-2021 at 10:08 AM.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Listbox Multiselect

    You have asked on TWO other sites - links to both are required before you will get any further help here.

    And you need to read the forum rules ASAP.

    EDIT: Thank you for the second link.
    Last edited by AliGW; 09-18-2021 at 10:14 AM.

  11. #11
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    Please Login or Register  to view this content.
    The error saying, could not get the selected property Andy pope

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

    Re: Listbox Multiselect

    Start again - you are tying yourself up in knots - going round in circles with repetition - you need ONE table with an extra field for 'Section'
    You then load the listbox with the filtered 'visible rows of the table' - saves all the nonsense of loading the listbox from 'active sheets'
    You will see that 'UbahData' does not appear to be 'Set' unless the 'Update' button has been previously been pressed.
    Start your UserForm code with the statement 'Option Explicit' as the very first line of code then follow that by declaring ALL your variables before any 'Subs' code.
    That way your variables are available throughout all your UserForm code, if you declare them within a 'Sub' they are only operative within that 'Sub' and lose their value as you exit the 'Sub'.
    As soon as you have 'Option Explicit' at the head you will amaze yourself how much simpler 'debugging' becomes - saving yourself much time scratching your head.
    Torachan,

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

  13. #13
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    Thank you torachan for the advices. I Appreaciate your advices to improve myself as beginner

  14. #14
    Registered User
    Join Date
    08-25-2021
    Location
    Kuching, Malaysia
    MS-Off Ver
    2016 32bits
    Posts
    30

    Re: Listbox Multiselect

    The problem was solved, Visit https://www.mrexcel.com/board/thread...elect.1182210/ for solving method, 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. [SOLVED] Listbox Multiselect
    By jimpatel1993 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-16-2021, 08:31 AM
  2. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  3. ListBox.MultiSelect Question
    By Guido Meng in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2012, 03:15 PM
  4. Listbox (MultiSelect)
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2008, 11:58 PM
  5. [SOLVED] Multiselect Listbox use
    By RKS in forum Excel General
    Replies: 1
    Last Post: 05-12-2006, 10:10 AM
  6. [SOLVED] Bug in multiselect listbox?
    By Jos Vens in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 04:45 PM
  7. Action on Multiselect Listbox
    By Sige in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2005, 03:06 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