# Deleting inside a listbox with 2 columns



## xsmurf (Dec 19, 2022)

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


```
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
```


----------



## xsmurf (Dec 20, 2022)

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


----------

