ListIndex

T

Todd Huttenstine

I have a combobox called ComboBox3. One of the values in
the combobox is "Export from Un-Opened Workbook..."
Now I dont know what position it is in the combobox but I
know I want it moved to the very end. The below code
tells me how many items are in the combobox. If variable
IndxNumber = 4, then I want for the value "Export from Un-
Opened Workbook..." to be moved to listindex postion
number 4 (very last position)

Dim IndxNumber
IndxNumber = ComboBox3.ListIndex + 1


How do I do this?

Thank you
Todd
 
B

Bob Phillips

Hi Tood,

One way

Dim sValue
Dim i As Long
Dim j As Long

With ComboBox1
For i = 0 To .ListCount - 1
If .List(i) = Export from Un-Opened Workbook..." Then
sValue = .List(i)
For j = i To .ListCount - 2
.List(j) = .List(j + 1)
Next j
.List(.ListCount - 1) = sValue
Exit For
End If
Next i
End With



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Todd Htutenstine

Thanks
-----Original Message-----
Hi Tood,

One way

Dim sValue
Dim i As Long
Dim j As Long

With ComboBox1
For i = 0 To .ListCount - 1
If .List(i) = Export from Un-Opened Workbook..." Then
sValue = .List(i)
For j = i To .ListCount - 2
.List(j) = .List(j + 1)
Next j
.List(.ListCount - 1) = sValue
Exit For
End If
Next i
End With



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top