ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating listbox with only one data (https://www.excelbanter.com/excel-programming/393833-populating-listbox-only-one-data.html)

[email protected]

Populating listbox with only one data
 
I have to listbox controls. This form allows you to move data from one
listbox to the other


ListBox ADDBUTTON - Listbox2

If you can imagine the above when you hit the ADDBUTTON it should move
one of the rows from the left listbox to the right one. I just want
one piece of data to move over . Is there a parameter to do this?


Anony

Populating listbox with only one data
 
This is the event handler for AddButton upon click:

Private Sub AddButton_Click()
If ListBox1.ListIndex = -1 Then Exit Sub
For i = 0 to ListBox2.ListCount - 1
If ListBox1.Value = ListBox2.List(i) Then
Exit Sub
End If
Next i
ListBox2.AddItem ListBox1.Value
End Sub

" wrote:

I have to listbox controls. This form allows you to move data from one
listbox to the other


ListBox ADDBUTTON - Listbox2

If you can imagine the above when you hit the ADDBUTTON it should move
one of the rows from the left listbox to the right one. I just want
one piece of data to move over . Is there a parameter to do this?




All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com