Userform listbox populates after pressing enter


New Member
Dec 7, 2016
I am new to VBA and am trying to teach myself while putting together some things for work. I am hoping that one of your geniuses can help me out. I have used this forum often and it has a ton of great people so lets get to it.

Goal: I want to be able to add an item number and quantity to a listbox. Be able to modify the quantity if need be and then send all the data to the appropriate spreadsheet.

I have 2 text boxes in a userform. The first, "Cntrl1", has an item number in it. The second, "Cntrl2", has a quantity. I want to be able to press the enter key after entering a value in Cntrl2, and only if both Cntrl1 and 2 have values in them, and have both the values of Cntrl1 and Cntrl2 populate a listbox in the same user form called "Lstbx1". I want the values to be next to each other. I want to then be able to click on a row in the listbox and take the item number and quantity and return it to the proper textbox so the values can be edited and the original will be replaced by the edited after pressing enter. I believe I have this part down but the goal will be to press a submit button and have the values of the listbox populate a spreadsheet.

I know that sounds a little confusing but I would be happy to provide any additional info if needed.

Thanks for any help.

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics