Here is one way.
What I am doing is capturing the listbox elements in an array and changing
the array, then reloadingf the listbox. I have included a dummy routine to
show how I load to start etc.
Option Explicit
Dim aryList
Private Sub CommandButton1_Click()
Dim i As Long, j As Long
Dim iStart As Long
Dim iEnd As Long
iStart = Evaluate("MIN(IF(A1:A1000<>"""",MONTH(A1:A1000)))")
iEnd = Evaluate("MAX(IF(A1:A1000<>"""",MONTH(A1:A1000)))")
ReDim aryList(1 To iEnd - iStart + 1)
For i = iStart To iEnd
j = j + 1
aryList(j) = Format(DateSerial(Year(Date), i, 1), "mmmm")
Next i
ListBox1.List = aryList
End Sub
Private Sub cmdUp_Click()
Dim tmp
With Me.ListBox1
If .ListIndex > 0 Then
tmp = aryList(.ListIndex)
aryList(.ListIndex) = aryList(.ListIndex + 1)
aryList(.ListIndex + 1) = tmp
.List = aryList
End If
End With
End Sub
Private Sub cmdDown_Click()
Dim tmp
With Me.ListBox1
If .ListIndex < .ListCount - 1 Then
tmp = aryList(.ListIndex + 1)
aryList(.ListIndex + 1) = aryList(.ListIndex + 2)
aryList(.ListIndex + 2) = tmp
.List = aryList
End If
End With
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)