Dear all,
Pls help me with the following problem:
I have a variable number of vertical ranges (vertical string arrays): from column A to, lets say, D.
The number of arrays can vary. For example could be from column A to H instead of D.
Each array has a variable number of string elements (up to 1000)
Here is an example below.
A B C D
1 str1 str4 str10 str12
2 str2 str5 str11 str13
3 str3 str6 str14
4 str7
5 str8
6 str9
I do know how to determine how many vertical ranges / arrays I have and how many elements has each range / array at runtime.
In the end I need to concatenate the elements as follows
str1 & str4 & str10 & str12
str1 & str4 & str10 & str13
str1 & str4 & str10 & str14
str1 & str4 & str11 & str12
str1 & str4 & str11 & str13
str1 & str4 & str11 & str14
str1 & str5 & str10 & str12
str1 & str5 & str10 & str13
.
.
.
str3 & str9 & str11 & str14
This could be achieved with a DEFINITE or a FIX number of FOR or DO loops, something like below:
FOR i=1 to num_elements(columnA)
FOR j=1 to num_elements(columnB)
FOR k=1 to num_elements(columnC)
FOR l=1 to num_elements(columnD)
....
next
next
next
next
My problem arises because I do not have a fix number of arrays (columns). I only know how many arrays I have at runtime... And at that time I cannot insert another FOR loop if needed.
One solution I think would be to write the code with maximum FOR or DO loops possible supported by Excel, but it does't seem to be very professional...
I am sorry for my very long explanation but I tried to make myself understood.
So, any useful ideas would be very appreciated.
Thanks and regards,
Catalin
Bookmarks