I have a UserForm and within it is ListBox. I have a 2 CommandButtons which are for scrolling Up & Down the list of data within the ListBox.
My problem is that when I run this code it just moves the line of data Up or Down and not the highlighted bar.
How can I do this?
My problem is that when I run this code it just moves the line of data Up or Down and not the highlighted bar.
How can I do this?
Rich (BB code):
Private Sub cmdUp_Click()
Dim ActionTemp As ActionDiary, iLi As Integer
iLi = Me.lstActions.ListIndex
If Not iLi = 0 Then
With ActionData(iLi)
ActionTemp = ActionData(iLi)
ActionData(iLi) = ActionData(iLi + 1)
ActionData(iLi + 1) = ActionTemp
End With
Call ClearActionsList
Call BuildActionsList
Me.lstActions.ListIndex = iLi - 1
End If
End Sub
Rich (BB code):
Rich (BB code):
Private Sub cmdDown_Click()
Dim ActionTemp As ActionDiary, iLi As Integer
iLi = Me.lstActions.ListIndex + 1
If Not iLi = Me.lstActions.ListCount Then
ActionTemp = ActionData(iLi + 1)
ActionData(iLi + 1) = ActionData(iLi)
ActionData(iLi) = ActionTemp
Call ClearActionsList
Call BuildActionsList
Me.lstActions.ListIndex = iLi
End If
End Sub