Thread: Save & Sort
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Redan Redan is offline
external usenet poster
 
Posts: 8
Default Save & Sort

Hello,

I have a very big excel file (approx. 58 MB) and every time I open my
worksheet I run a module which go thru each row (in 4 different columns ex.
| Ticker | Name | Category | Country ) and save the data in a dictionary and
once finished (which means approx after 8000 rows) I sort the result using
the following function :

Public Function SortArray(MyArray As Variant) As Variant
'Sort array
For lLoop = 0 To UBound(MyArray)
For lLoop2 = lLoop To UBound(MyArray)
If UCase(MyArray(lLoop2)) < UCase(MyArray(lLoop)) Then
str1 = MyArray(lLoop)
str2 = MyArray(lLoop2)
MyArray(lLoop) = str2
MyArray(lLoop2) = str1
End If
Next lLoop2
Next lLoop

'Output sorted array
SortArray = MyArray

End Function

My question is : Is there a way to save the result faster and also sort it
faster than the one I use at the moment ?

Thanks in advance.

Cheers!