Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm using the code below to copy the selected range in a multiple selection listbox to another listbox. After copying the values in the selection I would like to remove these values from the first Listbox, how do I do this? Cheers, Paul Private Sub CommandButton2_Click() Dim ind As Integer Dim tot_items As Integer Dim lastrow As Integer s = 7 d = 0 b = ActiveCell.Row a = ActiveCell.Column + 7 tot_items = ListBox4.ListCount lastrow = Sheets("X").Cells(Rows.Count, 5).End(xlUp).Row Application.ScreenUpdating = False For ind = 0 To tot_items - 1 If ListBox4.Selected(ind) Then d = d + 1 a = a + 1 Cells(b, a).Value = ListBox4.List(ind) ActiveCell.Value = ActiveCell.Offset(0, 8).Value Worksheets(5).Cells(lastrow, 5).Value = ListBox4.List(ind) lastrow = lastrow + 1 End If Next ind ActiveCell.Offset(0, 1).Value = ActiveCell.Offset(0, (d + s)).Value With frm_TDL Dim x As Integer Dim i As Long For x = 0 To tot_items - 1 If ListBox4.Selected(x) = True Then ListBox9.AddItem ListBox4.List(x, 0) ListBox4.Selected(x) = False End If Next For i = Me.ListBox4.ListCount - 1 To 0 Step -1 If Me.ListBox4.Selected(i) Then Me.ListBox4.RemoveItem (i) End If Next i End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
listbox remove item according to the value | Excel Programming | |||
Remove items from a listbox | Excel Programming | |||
listbox remove Item | Excel Programming | |||
Remove all Listbox items | Excel Programming | |||
Remove data with listbox | Excel Programming |