OVH Cloud OVH Cloud

Copier une valeur d'1 TextBox vers 1 ListBOx

2 réponses
Avatar
avi
Hello,
La reponse peut etre en Francais

I have a Userform with a ListBox and a TextBox.

I want the ListBox in column i in the selected row, to get its value
from the text enterd in the TextBox:

Each Time a row is selected in the ListBox, the TextBox should display
the value in that column and Vice Versa, the value in the ListBox could
be changed/edited by changing/editing the value in the TextBox.

I hope my request is clear enough.

Any piece of code will be appreciated

La reponse peut etre en Francais

Merci

2 réponses

Avatar
JB
Hello

Dim ancien
Private Sub b_ok_Click()
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.List(i) = ancien Then
temp = Me.ListBox1.List
temp(i, 0) = Me.TextBox1
Exit For
End If
Next i
Me.ListBox1.List = temp
End Sub

Private Sub ListBox1_Click()
Me.TextBox1 = Me.ListBox1
ancien = Me.ListBox1
End Sub

Private Sub UserForm_Initialize()
Me.ListBox1.AddItem "aaaaaa"
Me.ListBox1.AddItem "bbbbbb"
Me.ListBox1.AddItem "cccccc"
Me.ListBox1.AddItem "dddddd"
End Sub

Cordialy JB


Hello,
La reponse peut etre en Francais

I have a Userform with a ListBox and a TextBox.

I want the ListBox in column i in the selected row, to get its value
from the text enterd in the TextBox:

Each Time a row is selected in the ListBox, the TextBox should display
the value in that column and Vice Versa, the value in the ListBox could
be changed/edited by changing/editing the value in the TextBox.

I hope my request is clear enough.

Any piece of code will be appreciated

La reponse peut etre en Francais

Merci


Avatar
JB
See here: http://cjoint.com/?iyuydTIitB

JB

Hello,
La reponse peut etre en Francais

I have a Userform with a ListBox and a TextBox.

I want the ListBox in column i in the selected row, to get its value
from the text enterd in the TextBox:

Each Time a row is selected in the ListBox, the TextBox should display
the value in that column and Vice Versa, the value in the ListBox could
be changed/edited by changing/editing the value in the TextBox.

I hope my request is clear enough.

Any piece of code will be appreciated

La reponse peut etre en Francais

Merci