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