Sort of nested For/Next s (maybe?)

  • Thread starter Thread starter Alp Bekisoglu
  • Start date Start date
A

Alp Bekisoglu

Hi All,

Can't seem to set the logic behind this scenatio:
strA is a string of say 9 characters
strB is a string of 4 characters

I'd like to create a result string as:
(a1+b1)&(a2+b2)&(a3+b3)&(a4+b4)&(a5+b1)&(a6+b2)&(a7+b3)&(a8+b4)&(a9+b1)

For...Next for the A is ofcourse no problem but I couldn't figure out the
one for the inner.

Any help is highly appreciated.

Thanks in advance,

Alp
 
Try:

strA = "123456789"
strB = "abcd"

j = 1
For i = 1 To 9
strRes = strRes & Mid(strA, i, 1) & Mid(strB, j, 1)
j = j + 1
If j > 4 Then j = 1
Next i
 
Thanks Albert, for preventing me from loosing my hair! Well, what is still
left that is...

Alp
 
Alp said:
Can't seem to set the logic behind this scenatio:
strA is a string of say 9 characters
strB is a string of 4 characters

I'd like to create a result string as:
(a1+b1)&(a2+b2)&(a3+b3)&(a4+b4)&(a5+b1)&(a6+b2)&(a7+b3)&(a8+b4)&(a9+b1)

What kind of an operation is that? Oh well, it's getting
late so here's some air code:

For K = 1 To Len(strA)
Result = Result & Mid(strA, K, 1)
Result = Result & Mid(strB, ((K - 1) Mod Len(strB)) + 1, 1)
Next K
 
Thank you Marsh, I will try this as well. Initially I managed to get myself
out of the mind-deadlock by Albert's help.

Sincerely,

Alp
P.S.: Good night
 
Back
Top