Creating a group for items in a listbox

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203
Is there a way to create groups of line items from the listbox?

I have a userform that allows me to show and hide certain columns. There are 2 listboxes in the userform; one to 'Show' the list item and the other to 'Hide' the list item. By double clicking the items in the listboxes, a user can move the items between lists. Here my idee:

I place a button called "Create Group" on the my userform. The "Create Group" button opens a new userform. The "Create Group" userform is similar to first userform, it has 2 listboxes. The first listbox will have all the list items. When the user double clicks a list item, the list item goes into the second listbox which becomes the group. The user can add as many list items to the second listbox for grouping. When they are finished, they enter the name of the grouping in a field box and click a button called "Finish". When they click "Finish", the newly created group name will appear in the first userform listbox. When a user double clicks the group name, all of the competitors associated with the group move to the opposite listbox which will allow the users to hide and show columns for groups of list items in one action.

Ideas?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Nope, afraid not.
Somebody else will need to assist you with this one.
 
Upvote 0
Thank you for trying. You have been a huge help with my project already. In your professional opinion, do you think what I am asking is possible?
 
Last edited:
Upvote 0
I helped you on the first part of this script. And I have been watching in silence as to what your wanting now.

Questions:
1. Why do you think you now need two UserForms?
2. If the whole object is to select more then one listbox item so you can hide or show more then one column all at once why not select them. With a multiselect listbox you can choose more then one.

Choose 5 listbox items press a button and presto 5 columns are hidden.
 
Last edited:
Upvote 0
Yes the first part is done, thank you for that. It works perfectly

1. Why do you think you now need two UserForms?
This was just one way I thought of accomplishing this idea

2. If the whole object is to select more then one listbox item so you can hide or show more then one column all at once why not select them. With a multiselect listbox you can choose more then one.
The object is not just selecting more than one listbox item at a time. Its allowing for groups to be created and added to the listbox as a new item. The group of list items represent a certain set of competitors that rival a specific segment of our business. So if we are comparing competitors based off of that segment, its much easier to choose the grouping of competitors rather than having to remember which competitors are involved with that segment/market.

For example: Apple Inc. has many competitors for many markets. They manufacture phones, mp3 players (ipods), Tvs, and they also have software, and apps. If Apple were using my spreadsheet for a competitor analysis, they might want to look at just the competitors in the Tv market separately. So in the listbox, they would only have to doubleclick the competitor grouping for Tvs.
 
Upvote 0
So if you plan to create several Groups how do you plan to keep those Groups groped so the next time you open the Userform the groups are still groped.

And all these items in the group are in row(7) stating in Column C I think it was it's been a long time.

I thought we only had 16 columns from what I remember.

So you will be deleting groups and then creating new groups all the time?

You know the values stored in a UserForm are lost when you close UserForm.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top