Copy Paste from a variable range to variable sheets in VBA 2013

sandero1970

New Member
Joined
Aug 23, 2013
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Dear Fellows,

I have a problem with a macro that should copy a range of data (transposed) in a sopecific sheet. The point is that:
1) a reference to the sheet is done in colomn A of sheet 2 (from P1 to P30)
2) the number of lines to be copied and transposed is not the same for each P (P1 to P30)

so practically, here is the table:
sheetPCNameStatus
P1P1_C1NTBA P1_C1STBA P1_C1
P1P1_C2NTBA P1_C2STBA P1_C2
P1P1_C3NTBA P1_C3STBA P1_C3
P2P2_C1NTBA P2_C1STBA P2_C1
P2P2_C2NTBA P2_C2STBA P2_C2
P2P2_C3NTBA P2_C3STBA P2_C3
P2P2_C4NTBA P2_C4STBA P2_C4
P3P3_C1NTBA P3_C1STBA P3_C1
P3P3_C2NTBA P3_C2STBA P3_C2
P4P4_C1NTBA P4_C1STBA P4_C1
P4P4_C2NTBA P4_C2STBA P4_C2
P4P4_C3NTBA P4_C3STBA P4_C3
P5P5_C1NTBA P5_C1STBA P5_C1
P5P5_C2NTBA P5_C2STBA P5_C2
P5P5_C3NTBA P5_C3STBA P5_C3
P5P5_C4NTBA P5_C4STBA P5_C4
P6P6_C1NTBA P6_C1STBA P6_C1
P6P6_C2NTBA P6_C2STBA P6_C2

<tbody>
</tbody><colgroup><col><col><col><col></colgroup>

So I want that:
RANGE (C2:D4) is pasted in worksheet P1
RANGE (C5:D8) is pasted in WS P2
...
And so on untill the last unblanck cell in column A is reached.

Thank you
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,811
Messages
6,127,020
Members
449,351
Latest member
Sylvine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top