Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Sort Data in a combobox list

Hi,

Will this help?

your code ..... then add ...

ReDim myarray(1 To myval.Count)

For i = 1 To myval.Count
myarray(i) = myval(i)
Next i

BubbleSort myarray
ComboBox1.List = myarray


Sub BubbleSort(List() As Variant)
' Sorts the List array in ascending order
Dim First As Integer, Last As Integer
Dim i As Integer, j As Integer
Dim Temp

First = LBound(List)
Last = UBound(List)
For i = First To Last - 1
For j = i + 1 To Last
If List(i) List(j) Then
Temp = List(j)
List(j) = List(i)
List(i) = Temp
End If
Next j
Next i
End Sub


"Kryer" wrote:

Private Sub UserForm_Initialize()
Dim sh As Worksheet
Dim rng As Range
Dim myval As Range
Dim myarray() As Variant

Range("C1").Select
Do Until ActiveCell = "GS"
Selection.End(xlDown).Select
Loop
Selection.Offset(1, 0).Select


Set sh = Workbooks("Book1.xls").Worksheets("Sheet1")
Set myval = Range(Selection, Selection.End(xlDown).Offset(1, 0))
Set rng = myval
myarray = rng
ComboBox1.List = myarray
End Sub

I am trying to figure out how to make this selection post a sorted ascending
list in the combobox on initialize. the combobox range varies in as many
listings as in names available. This could list from 100 - 200 names on any
given day and having to run thru this list unorganized is a nitemare. Any help

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
Data validation list, combobox CousinExcel Excel Discussion (Misc queries) 0 April 9th 10 11:38 AM
how to sort the data in drop down list Sumeth Excel Discussion (Misc queries) 2 December 26th 07 04:32 PM
Extracting Data after a List Sort Mark Excel Discussion (Misc queries) 0 September 18th 07 02:40 PM
ComboBox in a Data Validation List... Bob Barnes Excel Discussion (Misc queries) 3 January 6th 06 11:04 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM


All times are GMT +1. The time now is 12:30 PM.

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"