'*************************
' Sposta gli Item Su e giu ' progetto aggregaPDF '************************* '0 su '1 giu Dim Sele As Boolean For I = 0 To List1.ListCount - 1 If List1.Selected(I) = True Then Sele = True Exit For End If Next If Sele = False Then MsgBox "Seleziona un elemento e premi il tasto per muovere", vbCritical, "Nessun ITEM selezionato" Exit Sub End If Dim MyArr() As Variant ReDim MyArr(List1.ListCount) Dim M As Long If Index = 0 Then ' SU For M = 0 To List1.ListCount - 1 If M + 1 = I Then MyArr(M) = List1.List(I) I = M MyArr(M + 1) = List1.List(M) M = M + 1 Else MyArr(M) = List1.List(M) End If Next Else ' GIU For M = 0 To List1.ListCount - 1 If M = I Then ' fine corsa If M + 1 <= List1.ListCount - 1 Then MyArr(M) = List1.List(I + 1) I = M + 1 MyArr(M + 1) = List1.List(I - 1) M = M + 1 Else Beep MyArr(M) = List1.List(M) End If Else MyArr(M) = List1.List(M) End If Next End If List1.Clear For M = 0 To UBound(MyArr) - 1 List1.AddItem MyArr(M) Next On Error Resume Next List1.Selected(I) = True |