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?
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
1,049
Office Version
  1. 2010
Platform
  1. Windows
Care to provide a current file to work with for testing ?
 

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203
Yes of course. Just give me some time to clean my current version of all proprietary data
 

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203

ADVERTISEMENT

Hi NoSparks,
Have you had any luck with this code?
 

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
1,049
Office Version
  1. 2010
Platform
  1. Windows
Nope, afraid not.
Somebody else will need to assist you with this one.
 

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203

ADVERTISEMENT

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:

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,448
Office Version
  1. 2013
Platform
  1. Windows
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:

gaudrco

Board Regular
Joined
Aug 16, 2019
Messages
203
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.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,448
Office Version
  1. 2013
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,872
Messages
5,627,393
Members
416,245
Latest member
Xterminat

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
Top