#1   Report Post  
mully
 
Posts: n/a
Default 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   Report Post  
dominicb
 
Posts: n/a
Default


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   Report Post  
mully
 
Posts: n/a
Default


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   Report Post  
dominicb
 
Posts: n/a
Default


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   Report Post  
mully
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Number Applying Value To Text Selection In List Box ANDYPAND New Users to Excel 2 July 19th 05 03:56 PM
Merge text list Rosie Excel Worksheet Functions 2 July 18th 05 06:09 PM
Making pick list conditional on selection from previous pick list Stewart Excel Discussion (Misc queries) 1 June 27th 05 11:30 AM
How do I create a bulleted list text format inside cell? DEH Excel Discussion (Misc queries) 5 February 1st 05 07:37 AM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"