# Double Loop To Copy And Paste

• Hi,

i have this code

i want to make a loop for the destination of the copy that starts in k = 2, as you have seen, and the step = 19... i have trying with different code, and putting the "for" loop in different places of this sentences, but it's impossible...

Anybody could help me???

Also, if somebody see that could make my code more easy, i would be very pleasant...

• Re: Double Loop To Copy And Paste

try

filippo

• Re: Double Loop To Copy And Paste

it doesn't work as i want, but thank you for your effort... your code only copy the rows that belong to 4258, which is the last reference...

i need a code that could copy the first 16 rows that belong to every reference (4102,4104,4106......) to the sheet called final... making a loop in the copy and in the paste... because maybe, in the future, i can add some references, and i need to not fix the row where i want to paste...

the easy option i managed was putting in the destination the cell i want, but, maybe every month i have to change the cell and the references... so it's a bit unefficient

• Re: Double Loop To Copy And Paste

just to avoid misunderstandings, could you psot a scracth of your workbook?

filippo

• Re: Double Loop To Copy And Paste

Here you have the first sheet where i have to extract the data to copy to the sheet "final"

## Files

• Re: Double Loop To Copy And Paste

albatros81,

in your file portfolio 4102 has 21 entries, 4104 has 24, etc. Is there a special reason to choose the first 16? What exactly do you mean with

Quote

step = 19

?

what exactly would you like to do? is it the total exposure for issuer?

filippo

• Re: Double Loop To Copy And Paste

I choose the first 16th because are the most representative of the reference... i have attached a little part of the real sheet. The real sheet has 2200 rows aprox... you can see also a reference (4341) that it's not included in the "final", because only have 3 rows (here, in the little attached, only appear one)...

i need to step 19 because the first 16th rows are for the paste, the 17th is for a sum of % that are >5% of every reference, and the other is for a blank row...

• Re: Double Loop To Copy And Paste

I think I got it

filippo

• Re: Double Loop To Copy And Paste

you got it, yeah! fantastic man!

but, to be honest, it's different to my original result... because, you can see that the reference 4153 is the last for me, and for you appears after the reference 4104... i know that i can sort it after apply your code or copy/paste to the last row... but your code is more efficient than mine, so... could you make your code sort as i want directly?

or, would you do after your code... sorting or copy/paste? Because, in this case, i could do this also without any problem, and i don't want to annoy you...

what do you think about?

• Re: Double Loop To Copy And Paste

OK, let's try this one

filippo

• Re: Double Loop To Copy And Paste

incredible...

it works in the way i wanted... i think i have to study a little more to do this kind of things...

fantastic filippo... and thanks again for all... you're great!

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!