MrExcel Publishing
Your One Stop for Excel Tips & Solutions

One for Ben O

Posted by Barry Divers on July 12, 2001 11:35 AM

Hi Ben
Thanks for your help on the data input box and I am nearly there. What I need to do is select the item from the list box and whatever I put in the text boxes is entered against the item selected from the list (if that makes sense.

Posted by Ben O. on July 12, 2001 12:11 PM


I think I understand what you're trying to do.
First, you'll need to assign the value that the user selects from your listbox to a variable:

listItem = Listbox1.Value

Then you'll want to use a Find statement to find the address of the cell that contains that value:

listItemLoc = Cells.Find( {fill in your parameters here} ).Address

Once you get that address, you can easily have the values of your text boxes entered in the adjacent cells.

listItemLoc.Offset(0,1).Value = TextBox1.value
listItemLoc.Offset(0,2).Value = TextBox2.value