BTW, How come I can say SUM(A1:A10) but I cannot say CONCATENATE(A1:A10)?!
That is a good question. My only answer is because the Excel gods/programmers have decreed it so. FWIW, I have seen mention of a UDF floating around the internet that is supposed to allow a range concatenate like that.
The scope of the concatenation is calculated.
It may be calculated, but it is calculated outside of the function and the results passed to the function as arguments. The idea is to change the code in such a way that you can specify in the argument list what range is being used for the concatenation. So, for example, one idea is to pass the main range to the function like this:
It was quickly put together, so it may still need work, and I think I'd probably take a different approach overall. But, in this version of the code, ccrange holds the reference to the range that you want to take the concatenation from. It is still using colstrt and numchar to determine exactly what subset of ccrange to concatenate, but ccrange will be a direct reference to the range desired, rather than an unspecified range. The other thing I hope it illustrates is that, just because something isn't known exactly at compile time, doesn't mean we shouldn't specify where that information will be stored and how it will be used.
In an overall sense, if I were writing this, I'd probably drop colstrt and numchar, and use the OFFSET() or INDIRECT() functions in the function call to determine the range needed, then pass that range to the msconcat function as the only argument. It should be able to work the same, unless I am completely misunderstanding what you are trying to do.
Bookmarks