Fair point. Handle multiple-area ranges separately, and single area ranges by converting to their .Value arrays.
Then use a profiling macro.
Yes, processing single-area ranges is slower than processing arrays, and processing multiple-area ranges is a lot slower still. However, if a TEXTJOIN replacement needs to function as close to the actual TEXTJOIN in Excel 2019 and later, isn't slow preferable to impossible?
Given the profiling macro above, on my system processing multiple-area ranges takes 140% more time than 1D arrays, processing single-area ranges takes 40% more time than 1D arrays, and processing 2D arrays takes 11% more time than 1D arrays (I supplemented the macro above for 2D arrays).
Note also that my profiling macro performs 500,000 iterations. Each For loop takes under 30 seconds, so each iteration, thus textjoin call, takes on the order of tens of microseconds. Given the speed of individual calls, my own preferences is to handle multiple-area ranges. That's subjective; others may have different preferences.
Bookmarks