Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
I was wondering if anyone can help me, I have a listbox on a form in excel
that has row source of a data range from one of the sheets(called LIST). I would like to add a button to the form that when clicked will remove the currently selected item from the listbox and also removesthe corresponding values from the worksheet. Also, is it possible to take the removed values and paste them elsewhere on the sheet? Any help would be greatly appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
Dim iRow As Long
With Me.ListBox1 On Error Resume Next iRow = Application.Match(.Value, Range(.RowSource), 0) On Error GoTo 0 If iRow 0 Then Range(.RowSource).Cells(iRow, 1).EntireRow.Delete End If End With -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Andy" wrote in message ... I was wondering if anyone can help me, I have a listbox on a form in excel that has row source of a data range from one of the sheets(called LIST). I would like to add a button to the form that when clicked will remove the currently selected item from the listbox and also removesthe corresponding values from the worksheet. Also, is it possible to take the removed values and paste them elsewhere on the sheet? Any help would be greatly appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
I appreciate the help, but the code you supplied is having problems as it
wasn't doing anything when the button was pressed. When I removed the on error commands, it told me that the following line had a type mismatch error: iRow = Application.Match(.Value, Range(.RowSource), 0) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
That means it cannot find the data in the data.
What does the data look like, and where is it (cells) and what is your final code? -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Andy" wrote in message ... I appreciate the help, but the code you supplied is having problems as it wasn't doing anything when the button was pressed. When I removed the on error commands, it told me that the following line had a type mismatch error: iRow = Application.Match(.Value, Range(.RowSource), 0) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
The data source for the list box is 5 columns on a spreadsheet (A:E), first
column contains numbers, second text, third numbers, fourth text and fifth text. The code i'm not too sure about as I was having problems getting it to remove the item from the listbox and the corresponding data in the cells, so the button the code is applied to is actually blank at the moment. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove items from a listbox
show us the code that is a problem.
-- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Andy" wrote in message ... The data source for the list box is 5 columns on a spreadsheet (A:E), first column contains numbers, second text, third numbers, fourth text and fifth text. The code i'm not too sure about as I was having problems getting it to remove the item from the listbox and the corresponding data in the cells, so the button the code is applied to is actually blank at the moment. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
add items to listbox | Excel Programming | |||
Remove all Listbox items | Excel Programming | |||
Adding Items to a ListBox-Unique Items Only | Excel Programming | |||
Items in a Listbox | Excel Programming | |||
Simple Listbox question - how to remove items | Excel Programming |