If I were debugging this, I would look carefully at the data types of each variable/array element.
which would be a text string.
In my experience, the Split() function returns an array of strings, and Excel's MIN() function is programmed to ignore strings (including numbers stored as strings), worksheetfunction.min(arr) returning 0 seems correct to m, assuming that arr() is an array of strings at this point (you should be able to see the data type in your locals window).
worksheetfunction.min(str2) returning that large number surprises me a little. It appears that VBA is doing some kind of string to number conversion where it is assuming those commas are thousands separators, so it assumes that the entire text string is one large number. Of course, the minimum of one large number is whatever that number happens to be (in this case 871815523930153 -- up to the 15 digits that a double will hold).
If I were doing this, I think I would just build the array inside of the For... Next loop rather than a comma delimited text string. maybe something like
that should build arr as an array of longs that shows where in midbit each of the strings in str1 is found. (I cannot test it here, but you seem to have enough skill to test, debug, and edit as needed).
Bookmarks