I have the following code which converts a cell string into a string of Ascii codes separated by comma:
Dim Str As String
Dim MyString As Variant
L = Len(Cell.Value)
c = Cell.Value
For P = 1 To L
Sep = ","
If P = L Then Sep = ""
NextVal = Asc(Mid(c, P, 1)) & Sep
Str = Str & NextVal
This works and if I put a Stop command in and hover over Str I see the comma separated list of Ascii codes.
I now want to refer to particular elements of the string so assume I need to convert it to an array so that I can use "Array(n
)" to refer to the nth element of the array. How do I convert the string to an array or add the values to the array one at a time?
More specifically I want to sort the array into numerical order so am looking at using SMALL function to retrieve the Array elements in numerical order.
I have tried with adding:
MyString = Array(Str)
Ch = MyString(1)
Line 2 is trying to pull the first value from the Array but I get Subscript out of Range on that line.
Assistance much appreciated.