Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Data

Status
Not open for further replies.

max1565

Technical User
Dec 16, 2002
57
0
0
US
I have a listbox with 15 rows and ten columns of data. The only column visible is peoples names. When the user selects a name I would like for the following to happen. I would like for the information on the row selected to be entered in to sheet("data") ie:

value in column1 goes to sheet("data").range(a1")
value in column1 goes to sheet("form").range(b1")
value in column2 goes to sheet("data").range(b1")
value in column3 goes to sheet("data").range(c1")
and so on

is this possible?
Thanks
 
someone please let me know if this can be done

Thanks
 
Thanks, i finally figured it out.
 
Hi Max1565,

Can you tell me how you figured this out? Also, how did you add multiple columns in the listbox? I have a similar situation where I want to allow the users to see account names, but have the account numbers hidden, but available for my use.

Thx in advance for any help you can give me.

joe
 
To set what columns are visible:

click on the listbox, and go to the column width in the properties. Set the width for width for the first column(when i made my table for loading I put the column I wanted to see when form was loaded in the first column)to what value it takes to show the column. In my case it was 100pt.

Enter values for all the columns. For any column that you don't want to see use 0pt.

Below is the code I used to for the form.


Private Sub CommandButton1_Click()
Unload UserForm2
UserForm2.Hide


''''Enter Listing Agent
Worksheets("TEMPDB").Range("K3").Value = ListBox1.List(ListBox1.ListIndex, 0)
Worksheets("form").Range("d4").Value = ListBox1.List(ListBox1.ListIndex, 0)

''''Enter Listing Agent ID
Worksheets("TEMPDB").Range("E3").Value = ListBox1.List(ListBox1.ListIndex, 1)

'''enter split percentage
Worksheets("FORM").Range("E4").Value = ListBox1.List(ListBox1.ListIndex, 2)
Worksheets("work").Range("c40").Value = ListBox1.List(ListBox1.ListIndex, 2)

'''enter TEAM INFORMATION
Worksheets("TEMPDB").Range("AJ3").Value = ListBox1.List(ListBox1.ListIndex, 3)
Load UserForm3
UserForm3.Show

End Sub

Private Sub CommandButton2_Click()
Unload UserForm2
UserForm2.Hide
sheets("CONTROLS").Select
Range("D12").Select
End Sub

Private Sub ListBox1_Click()

End Sub

Private Sub UserForm_Click()

End Sub


Private Sub UserForm_Initialize()
sheets("work").Select

ListBox1.ColumnCount = 3
ListBox1.RowSource = "a4:D23"


End Sub

I hope this helps. Let me know if you have any questions
 
One thing i forgot. When you are entering the column widths in the properties, you separate the values with ;

Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top