Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Listbox problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Robert Crandal, post: 6455950"] Sure, I can show you some bits of my code, but I'm also willing to look at someone else's code for alternative solutions. I first created a global array of strings in one module. The global declaration looks like this: Public g_Arr() As String ' My global array of strings Then, when the userform is created during "UserForm_Initialize()", I call "ReDim g_Arr" to resize that array to match the current number of elements in column A. I then load all strings into the "g_Arr" array. Next, I then call the function below to sort the array: '--------------------------------------------------- Sub Sort_Array_of_Strings(Arr() As String) ' g_Arr is passed in here! Dim i, j As Integer Dim str1, str2 As String For i = 0 To UBound(Arr) For j = i To UBound(Arr) If UCase(Arr(j)) < UCase(Arr(i)) Then str1 = Arr(i) str2 = Arr(j) Arr(i) = str2 Arr(j) = str1 End If Next j Next i End Sub '------------------------------------------------ One of my main problems is that the sorted list of strings in the listbox does NOT match the unsorted order of the data on the spreadsheet, which makes it hard to find the correct row index. Does that make sense? Also, I would really prefer to solve this using a one column listbox, not a two column listbox. Does anyone have any other ideas? I would appreciate it. - Robert C. [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Listbox problem
Top