If I have selected more than one selection in List Box, I am not able to delete all of my selected values. It either Deleting from Top or Bottom. I have already searched for codes in internet and whatever i got, it is not working for me.Code given for your reference:
Private Sub Cmd_Del_Click()
Dim sh As Worksheet
Set sh = ThisWorkbook.Worksheets("Sheet1")
Dim i As Long
For i = Me.LB_ZoneRegion.ListCount - 1 To 0 Step -1
If Me.LB_ZoneRegion.Selected(i) = True Then
sh.Range("A" & i + 2 & ":B" & i + 2).Select
Selection.Delete
End If
Next i
Call UserForm_Initialize
End Sub
Private Sub UserForm_Initialize()
On Error Resume Next
With Me.LB_ZoneRegion
.Clear
.ColumnCount = 2
.ColumnHeads = True
.ColumnWidths = "40;50"
.RowSource = "ZoneRegion"
.MultiSelect = fmMultiSelectMulti
End With
End Sub
Last edited: