MoveDown + MoveUp

Moves an item in listbox up or down
Needs Lst1 as listbox name
Put code inside form (or userform)

CodeFunctionName
What is this?

Public

Tested

Original Work
Sub MoveDown()
If Lst1.ListIndex < 0 Then Exit Sub
If Lst1.ListIndex = Lst1.ListCount - 1 Then Exit Sub
temp1 = Lst1.List(Lst1.ListIndex + 1)
Lst1.List(Lst1.ListIndex + 1) = Lst1.List(Lst1.ListIndex)
Lst1.List(Lst1.ListIndex) = temp1
Lst1.ListIndex = Lst1.ListIndex + 1
End Sub
Sub MoveUp()
If Lst1.ListIndex < 1 Then Exit Sub
temp1 = Lst1.List(Lst1.ListIndex - 1)
Lst1.List(Lst1.ListIndex - 1) = Lst1.List(Lst1.ListIndex)
Lst1.List(Lst1.ListIndex) = temp1
Lst1.ListIndex = Lst1.ListIndex - 1
End Sub

Views 3,318

Downloads 1,523

CodeID
DB ID

ANmarAmdeen
608
Revisions

v1.0

Saturday
June
2
2018