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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting a text into a list box

Status
Not open for further replies.

dixiematic

Technical User
Oct 14, 2008
37
SI
Hello,
I have a multiline listbox with the 1-fmListStyleOption (check boxes in the first column). The second column is linked with a ListFillRange to some range of values on a worksheet. Now what I am trying to do is: when I choose a check box, I would like to enter a short text to the third column of the selected row.
Later I would use selected rows for further calculations.
I cannot find a way to do it.
m777182
 
In this case you need to go through linked range and supporting textbox:
Code:
Private Sub ListBox1_Change()
Me.TextBox1.Text = Me.ListBox1.List(Me.ListBox1.ListIndex, 2)
End Sub

Private Sub TextBox1_Change()
Me.Range(Me.ListBox1.ListFillRange)(Me.ListBox1.ListIndex + 1, 3) = Me.TextBox1.Text
End Sub

combo
 
Thanks, Combo.
I am afraid that my ExcelVba(Excel 2007) does not accept the instruction "object.List( row, column )": could not get the list property, invalid argument. However, it accepts the instruction "object.List(row)" although in its help file there is an explanation for "object.List( row, column )". I am googling for an reasonable explanation.
Dixiematic
 
Do you have the list set to have three columns (or more)?

combo
 
To Combo
Yes, MyListBox ColumnCount=3 and my BoundColumn=2,- this one is bound to the range on the worksheet.
Dixiematic
 



I set up a Named Range for the source data of 3 columns and x rows.

I assign the ListFillRange the Range Name in the Control Toolbox Properties.

Every change in the RANGE on the sheet is reflected in the contol list. NO CODE REQUIRED.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
to SkipVought:
thanks for your attention. What I would like to do is an activeX control for the input of data: in a listbox there is a list of possible (about 60 items)values offered to the user( bound to a hidden worksheets range). If he chooses a particular value, an InputBox asks him to input his measured value. I am using the inputBox to provide some filtering of nonsence data. This very input value I would like to appear in a ListBox as column 3 text, adjacent to the chosen value from the range.
If one deselects a Checkbox in column1, the entered value in column 3 should disappear, while the proposed values in column2 should stay there.
Dixiematic
 


So you have the select INDEX.

That give you a ROW OFFSET in the list fill data range. Go assign the input value to the appropriate column.

Seems simple, or am I missing something.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top