A shorter and less error prone solution would be:
Dim arr arr = Split("Q1 Q2 Q3 Q4") : ubd = UBound(arr) ' Implied separator is " " aka 040 octal aka 32 Dec aka 020 Hex.
If your data may contain spaces:
arr = Split("Le Sage,ne pleure,ni les vivants, ni les morts", ",") ubd = UBound(arr) ' arr(2), for instance, now contains "ni les vivants"
Attention: never choose a separator that may appear in your "atomic" data rows, or the function will be divided on this separator in the middle of one piece of data.
LeChatDeNansen
source share