PDA

View Full Version : Multiselect Multicolumn Listbox allow users to add data?



baller1013
10-23-2017, 05:41 PM
I have two list boxes on a user form. The first list box displays the data contained in A2:B700. The user then adds their selections from listbox1 to listbox2. Prior to saving the selection to a worksheet, I want to obtain two additional pieces of information about what was selected and is currently being displayed in listbox2. I am struggling with what the best approach would be to this problem. The biggest problem is that some users may select two values from listbox1 others may select up to 600. The problem with using a 4 column listbox (i.e., A2: D700) is that the last two columns will be blank until users enter values. Any insight would be greatly appreciated, my deadline is rapidly approaching.

Kenneth Hobs
10-23-2017, 06:39 PM
Welcome to the forum!

If you set the userform to show vbModeless and allow the users to edit the data while the userform is active, then you will need to refill your listbox.

Why not just use 4 columns for both? You can always hide columns in the listbox control by setting the ColumnWidths property for those columns to 0. e.g. 22; 22; 0; 0

baller1013
10-24-2017, 07:22 AM
I did not explain my dilemma very well, sorry! Right now the user selects data (2 columns) from a listbox ranging from 1 selection to 600. Their selection is moved to a listbox2 to be committed to the worksheet. Prior to adding the selection or perhaps after committing the selection, I need the user to enter two dates regarding each selection. How can I do this?






Welcome to the forum!

If you set the userform to show vbModeless and allow the users to edit the data while the userform is active, then you will need to refill your listbox.

Why not just use 4 columns for both? You can always hide columns in the listbox control by setting the ColumnWidths property for those columns to 0. e.g. 22; 22; 0; 0

Kenneth Hobs
10-24-2017, 01:28 PM
And what happens after they enter the values?

For the same value for all selections in say column 3 and another for column 4, then 2 TextBox controls would do. For more than one selection, it gets more difficult. I can't image adding 1,200 TextBox controls.

Here's an idea. Add two Combobox controls. Set the BoundColumn property to 3 for one and 4 for the other.

Another idea, show the userform with vbModeless. The data could be filtered is say Column A had unique values. The user could then e allowed to only edit

Another idea, same as above but a scratch sheet is presented to complete the selected rows.

If you just allowed one selection, the columns 3 and 4 could be filled to TextBox controls. Updates to them with one selection in ListBox would update its 3rd and 4th column.