I have a table that I convert to an array in VBA. I used this array to find and replace a list of data I have. What I do is to manually sort my table using the character length of the first column (using len function of Excel) before I run my whole code, which works just fine. However, I want to implement it in such a way that the array would internally sort (by the character length of the first column) in the VBA code so that I don't have to sort it manually and any additional entry wont have to be resorted as well. Do you know any function (or developed function like the Quicksort here) that I can use?
This is the part of my code that converts my Table to an array (in a column array format). I plan to use the function after putting it inside the myArray variable. Thanks for the help in advance.
'Create variable to point to your table
Set tbl = Worksheets("Sheet2").ListObjects("Table1")
'Create an Array out of the Table's Data and sort it by length
Set TempArray = tbl.DataBodyRange
myArray = Application.Transpose(TempArray)