Home |
Search |
Today's Posts |
#1
|
|||
|
|||
List box to Text Box
Hi
On a userform I have a list box that consists of 4 columns e.g. 121 - Joe Bloggs - 493 -1647 I would like to do the following on the same userform after highligting the line 121 - Joe Bloggs - 493 - 1647 - in the list box. TextBox1 = 121 TextBox2 = Joe Bloggs TextBox3 = 493 TextBox4 =1647 all I end up with when trying to do it is that all the TextBoxes have 121 in them Any help to solve this problem is much appreciated Mully |
#2
|
|||
|
|||
Good morning Mully This piece of code should help, in your Userorm_Initialize: Private Sub UserForm_Initialize() TextBox1 = ActiveCell.Value TextBox2 = ActiveCell.Offset(, 1).Value TextBox3 = ActiveCell.Offset(, 2).Value TextBox4 = ActiveCell.Offset(, 3).Value End Sub HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=393594 |
#3
|
|||
|
|||
Good Morning Dominic Thanks for the help installed the code as you recommended and on opening the UserForm showed all the details from the Row on the Active Sheet and on clicking the command button "Add Info" it put the row details on another sheet correctly. However on highlighting a row in the List Box no details showed in the text boxes I had to go back to the sheet select a row and the new details showed. What I wanted to do was get the details from the List Box on the UserForm and just click "Add Info" Is this possible ???? Thanks Mully "dominicb" wrote: Good morning Mully This piece of code should help, in your Userorm_Initialize: Private Sub UserForm_Initialize() TextBox1 = ActiveCell.Value TextBox2 = ActiveCell.Offset(, 1).Value TextBox3 = ActiveCell.Offset(, 2).Value TextBox4 = ActiveCell.Offset(, 3).Value End Sub HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=393594 |
#4
|
|||
|
|||
Hi Mully Apologies for the delay in my reply. It depends on exactly how you've set up your list box, but I've just tested this piece of code and it seemed to be working OK - is this what you wanted? Private Sub ListBox1_Click() TextBox1.Value = ListBox1.List(, 0) TextBox2.Value = ListBox1.List(, 1) TextBox3.Value = ListBox1.List(, 2) TextBox4.Value = ListBox1.List(, 3) End Sub HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=393594 |
#5
|
|||
|
|||
Hi Dominic
Been busy myself -- out all morning. Just the job and spot on -- thanks for all your help much appreciated Mully "dominicb" wrote: Hi Mully Apologies for the delay in my reply. It depends on exactly how you've set up your list box, but I've just tested this piece of code and it seemed to be working OK - is this what you wanted? Private Sub ListBox1_Click() TextBox1.Value = ListBox1.List(, 0) TextBox2.Value = ListBox1.List(, 1) TextBox3.Value = ListBox1.List(, 2) TextBox4.Value = ListBox1.List(, 3) End Sub HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=393594 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Number Applying Value To Text Selection In List Box | New Users to Excel | |||
Merge text list | Excel Worksheet Functions | |||
Making pick list conditional on selection from previous pick list | Excel Discussion (Misc queries) | |||
How do I create a bulleted list text format inside cell? | Excel Discussion (Misc queries) | |||
Read Text File into Excel Using VBA | Excel Discussion (Misc queries) |