using a list box to fill text boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a form with 2 combo boxes and 1 list box that I would like to use to
automatically fill in numerous text boxes. The first combo box is the sheet
(and stored in variable myUnit for other uses) and the second is the column
(stored in myColumn also) and these generate the list box.

When someone clicks on an item in the list box I need to get more
information from that row and show them in the text boxes on the other side.
I am new at this and nothing seems to be working and appreciate your help.
 
I'm not quite sure how you've got your data setup but this should get you the
general idea.
Private Sub ListBox1_Click
Dim SelectCell As Range
Const oSet As Long = 0 'Offset that determines how what row to start on
Set SelectCell = Cells(ListBox1.ListIndex + oSet, myColumn)
TextBox1.Text = SelectCell
TextBox2.Text = SelectCell.Offset(,1) 'Cell to the right of SelectCell
TextBox3.Text = SelectCell.Offset(,-1) 'Cell to the left of SelectCell
End Sub

Post back if you need more help
 
Unfortunately I do not know what column they will be starting on as that is
the second combo box option. Once it is updated the list box then fills in
with all the values in that column that are not null.

I am also getting a run time error 13 – type mismatch message on the “Set
SelectCell†line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top