LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Remove from listbox

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
listbox remove item according to the value [email protected] Excel Programming 1 December 31st 07 09:35 AM
Remove items from a listbox Andy Excel Programming 6 November 28th 06 12:45 AM
listbox remove Item Simon Shaw Excel Programming 3 July 3rd 05 10:14 PM
Remove all Listbox items Todd Huttenstine Excel Programming 3 July 12th 04 09:56 PM
Remove data with listbox Josh[_9_] Excel Programming 8 February 24th 04 05:22 PM


All times are GMT +1. The time now is 11:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"