Hi,
I would like to adapt 2 codes that are working perfectly with a listbox with multiselect disabled. Here are the 2 codes written respectively by MickG and vaskov17 (thanks again):
You can download the .xlsm file there:
UserForm - Multiselect.xlsm - 0.03MB
Thanks in advance for the help!
I would like to adapt 2 codes that are working perfectly with a listbox with multiselect disabled. Here are the 2 codes written respectively by MickG and vaskov17 (thanks again):
Code:
Private Sub deplacer_haut_Click()
'Move up
Dim temp As String
Dim Ray
Dim ac As Integer
Dim n
With ListBox1
Ray = .List
n = .ListIndex
If Not .ListIndex = 0 And Not .Value = vbNullString Then
For ac = 1 To 2
temp = .List(.ListIndex, ac)
Ray(.ListIndex, ac) = Ray(.ListIndex - 1, ac)
Ray(.ListIndex - 1, ac) = temp
Next ac
.List = Ray
.ListIndex = n - 1
End If
End With
End Sub
Code:
Private Sub Effacer_Click()
Dim i As Integer
With ListBox1
If Not .ListIndex = -1 And Not .Value = vbNullString Then
.RemoveItem (.ListIndex)
If .ListIndex <> .ListCount - 1 Then
For i = .ListIndex To .ListCount - 1
.List(i, 0) = .List(i, 0) - 1
Next i
End If
End If
End With
End Sub
You can download the .xlsm file there:
UserForm - Multiselect.xlsm - 0.03MB
Thanks in advance for the help!