#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default ListIndex

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ListIndex

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)

"Todd Huttenstine" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default ListIndex

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)

"Todd Huttenstine"

wrote in message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform problem (Listindex) jgmiddel Excel Discussion (Misc queries) 1 April 26th 06 01:34 PM
Use ListIndex to set Sheet order? Stuart[_5_] Excel Programming 2 February 20th 04 01:22 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
ListIndex = cell value? Christy[_2_] Excel Programming 1 September 20th 03 03:19 PM


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"