Trying to find a more friendly way to loop through a large string
and fill specific substring values to each cell in a range. Currently I have created
these brute force types of codes, but it becomes a pain when a update needs to be made. Thanks for the help.
Couple different examples of what I'm using.
I would like to loop the outer loop once, then the innner loop once -- then start again with the outter loop.
So something like this for example where the third loop would be:
Using a more edit friendly loop structure like:
and fill specific substring values to each cell in a range. Currently I have created
these brute force types of codes, but it becomes a pain when a update needs to be made. Thanks for the help.
Couple different examples of what I'm using.
Code:
[COLOR=#008000] '
[/COLOR] [COLOR=#008000]'NG REASONS:
[/COLOR] For q = 5 To 16
Sheets("ATT").Range("B" & q) = Mid(Sheets("ATT").[B20], q - 4, 1)
Next q
[COLOR=#008000]'
'RCVD BY:
[/COLOR] For q = 15 To 26
Sheets("ATT").Range("C" & q - 10) = Mid(Sheets("ATT").[B20], q, 1)
Next q
[COLOR=#008000] '
'DATE RCVD:
[/COLOR] For q = 29 To 95 Step 6
Set Dval = Sheets("ATT").Range("D" & ((q - 5) / 6) + 1)
Dvals = Mid(Sheets("ATT").[B20], q, 6)
Dval = Format(Dvals, "##/##/##")
Next q
I would like to loop the outer loop once, then the innner loop once -- then start again with the outter loop.
So something like this for example where the third loop would be:
Code:
Sheets("ATT").Range("C7") = Mid(Sheets("ATT").[B20], 17, 1)
Using a more edit friendly loop structure like:
Code:
For q = 15 to 26
For i = 5 to 16
Sheets("ATT").Range("C" & i) = Mid(Sheets("ATT").[B20], q, 1)
next i
next q