Hi!
My main problem is how to convert a Range object into an Array without using any loops?
This is the background:
I need to write a user-defined function in VBA for Excel that takes a Range (2 cols and many rows) in an Excel-sheet as an argument and rearrange the rows so that the values in the left column is sorted by the quicksort algorithm.
The function should also take a string as an argument which it would use to do a binary search in the left (now sorted) column and finally the function would return the value in the right column that is on the same row as the found string.
How can I do this?
I already have two subs, one that sorts a 1-dim array (it must be an array) with quicksort, and one that performs a binary search on a 1-dim array.
My main problem is, as said above, how to convert a Range object into an Array without using any loops. Or maybe there is a totally different approach that is better? I don’t want to use Excel-functions, like vlookup or match.
Please Help!
/Hl
My main problem is how to convert a Range object into an Array without using any loops?
This is the background:
I need to write a user-defined function in VBA for Excel that takes a Range (2 cols and many rows) in an Excel-sheet as an argument and rearrange the rows so that the values in the left column is sorted by the quicksort algorithm.
The function should also take a string as an argument which it would use to do a binary search in the left (now sorted) column and finally the function would return the value in the right column that is on the same row as the found string.
How can I do this?
I already have two subs, one that sorts a 1-dim array (it must be an array) with quicksort, and one that performs a binary search on a 1-dim array.
My main problem is, as said above, how to convert a Range object into an Array without using any loops. Or maybe there is a totally different approach that is better? I don’t want to use Excel-functions, like vlookup or match.
Please Help!
/Hl