+ Reply to Thread
Results 1 to 11 of 11

Expandable Listbox items (Tree view)

  1. #1
    Forum Contributor Axmed.cm's Avatar
    Join Date
    02-05-2015
    Location
    Somalia
    MS-Off Ver
    2013
    Posts
    231

    Expandable Listbox items (Tree view)

    Hello,

    I have a listbox with items populated in runtime from worksheet data. I want a way that the items in the listbox can be expanded and collapsed.
    i used this code to populate the listbox
    Please Login or Register  to view this content.
    i attached a picture with the data and the desired result. I need your help for this.
    Data.jpg
    Thanks
    GUURE

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,050

    Re: Expandable Listbox items (Tree view)

    Andy Pope has an excellent class for doing this in a userform, but I don't think it'll work on a worksheet list box.
    Please Login or Register  to view this content.
    You could probably achieve that layout with a pivot table
    Attachment 715911

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Expandable Listbox items (Tree view)

    ..............Deleted..............
    Edit...Just realized I misunderstood the request...OP wants listbox to be manipulated by expanding the data...
    Last edited by sintek; 01-29-2021 at 07:30 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Expandable Listbox items (Tree view)

    Had a free gap...This works...Too much code to post...

    Double Click item...
    Attached Files Attached Files
    Last edited by sintek; 01-29-2021 at 10:44 AM.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Expandable Listbox items (Tree view)

    Thanks for rep +
    Does this help?

  6. #6
    Forum Contributor Axmed.cm's Avatar
    Join Date
    02-05-2015
    Location
    Somalia
    MS-Off Ver
    2013
    Posts
    231

    Re: Expandable Listbox items (Tree view)

    Dear Sintek, very helpful.

    It's possible to avoid the sorting and T/F in column E ?

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Expandable Listbox items (Tree view)

    Not with this code...Col E was used as a helper column...perhaps someone else can offer alternate solution...Good luck
    Last edited by sintek; 01-30-2021 at 08:11 AM.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Expandable Listbox items (Tree view)

    Axmed.cm

    Used TreeView
    1) To ThisWorkbook code module
    Please Login or Register  to view this content.
    2) UserForm1 code module
    Please Login or Register  to view this content.
    3) to Sheet1 code modue
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 01-30-2021 at 10:48 AM.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Expandable Listbox items (Tree view)

    And so we learn...Never seen this before...

  10. #10
    Forum Contributor Axmed.cm's Avatar
    Join Date
    02-05-2015
    Location
    Somalia
    MS-Off Ver
    2013
    Posts
    231

    Re: Expandable Listbox items (Tree view)

    Jindon, Thank you for this.

    But it is not working for me. it says
    Attachment 716103

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: Expandable Listbox items (Tree view)

    Can not open your attachment.

    You will need to add TreeView control on the form.
    goto [ToolBox], if you do not find it, right click on [ToolBox] - [Additional Controls] - tick [Microsoft Treeview Control] - [OK].

    Now you can add it on the form and name it as TreeView1 if it is named differently.

+ 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: 6
    Last Post: 01-04-2021, 06:09 AM
  2. [SOLVED] Microsoft tree view
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-22-2018, 11:26 AM
  3. Tree View Creation
    By may_sam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2011, 11:41 AM
  4. VLookup/Tree View...
    By hiteshparmar87 in forum Excel General
    Replies: 0
    Last Post: 03-09-2010, 09:55 AM
  5. Tree view control
    By GFK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-01-2009, 05:12 AM
  6. [SOLVED] Tree View of spreadsheet tabs: is it possible?
    By [email protected] in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-01-2006, 05:30 PM
  7. [SOLVED] VB Tree View
    By samycbe in forum Excel General
    Replies: 1
    Last Post: 02-23-2005, 12:06 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