Deleting inside a listbox with 2 columns

xsmurf

Board Regular
Joined
Feb 24, 2007
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a code that removes data from listbox that has 1 column.
It works perfect.
It also deletes only the info and not the entire row.

I am trying to adjust the code to remove data from a 2 column listbox and in the sheet.
I am having some difficulties.

Can someone help me to adjust the code

Thanks in advance

VBA Code:
Private Sub DeleteButtonEmail_Click() ' works
'PURPOSE: Remove any selected items from the ListBox

Dim X As Long
Dim OriginalCount As Long
Dim iCnt As Integer
'Store original ListBox count
  OriginalCount = CurrentEmailList.ListCount
 
    
    'Get Selcted Items from CurrentEmailList to DeletedNameEmailList
    For iCnt = 0 To CurrentEmailList.ListCount - 1
        'Check ListBox Item has selcted or not
        If CurrentEmailList.Selected(iCnt) = True Then
            DeletedNameEmailList.AddItem CurrentEmailList.list(iCnt)
        End If
    Next

  CurrentEmailList.Visible = False

'Delete selected line items
  For X = OriginalCount - 1 To 0 Step -1
    If CurrentEmailList.Selected(X) = True Then CurrentEmailList.RemoveItem X
  Next X

'Unhide ListBox
  CurrentEmailList.Visible = True

End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Also the data that needs to be removed is starts at E3. The columns used for the data is E & F
The sheet is called "Data"

Hope someone can help me

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,756
Messages
6,174,320
Members
452,555
Latest member
colc007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top