• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How do I code this?

Corrie80405

New Member
I am not a programmer. I am just creating stuff to make my own work easier.
Attached I have created a excel program. If it opens up and you click on clients it the user form opens, you click on clients again.

then at the bottom you will see the list box with all the information in. How do I code it to when I click in the list box that the data shows in the text box at the same time.

Thank you looking forward for some one's assistance. See attached.
 

Attachments

Fluff13

Active Member
How about
Code:
Private Sub ListBox2_Click()
   Dim i As Long
   For i = 1 To 14
      Me.Controls("textbox" & i) = Me.ListBox2.Column(i - 1)
   Next i
End Sub
 

Fluff13

Active Member
Change
Code:
For i = 1 To 14
to
Code:
For i = 1 To 30
But the rest of your Textboxes must be numbered to match the columns as they are for the 1st 14
 

Corrie80405

New Member
Hi I did it. It Only shows up to 25 Columns. The last 5 do not show in the text boxes.
And all my text boxes are numbered from 1 to 30 the are all in order.

Please advise see attached
 

Attachments

Fluff13

Active Member
That's because the loop is only running from 1 to 25, not 1 to 30.
Also textbox27 is missing the second x
 
Top