View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pawelski Pawelski is offline
external usenet poster
 
Posts: 1
Default Equlivelent to .NewIndex Property in VBA Excel ?

I am trying to make a listbox which is populated from a named range in
Excel that can then be reordered by clicking and dragging rows in the
listbox. I have found VB code that can do it, but when I tred to
recreate it in VBA I found that one of the properties, .NewIndex, does
not seem to exist in VBA. Here is the code with the nonexistant
property in it:


Private Sub ListBox1_Click()

End Sub

Private Sub ListBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
With ListBox1
DragIndex = .ListIndex
End With
End Sub

Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
With ListBox1
If DragIndex < .ListIndex Then
ListTest = .List(DragIndex)
.RemoveItem DragIndex
.AddItem ListText, .ListIndex + Abs(Shift = vbShiftMask)
.ListIndex = .NewIndex '<----**THIS IS THE PROBLEM**---<
End If
End With
End Sub

Private Sub UserForm_Click()

End Sub

Can anyone show this complete newbe a way around this missing
property?

Paul