Copy dynamic Range and pasteSpecial(Transpose)

odezi455

New Member
Joined
Sep 5, 2014
Messages
2
Hi all, I need help in structuring a lot of data file and I was wondering If anyone could help me.
what I want is to search for cell that starts with "CP" in range (A:A) then copy the next set of row untill the next "CP" and paste(transpose).
This is how the data is at the moment:
[TABLE="width: 129"]
<tbody>[TR]
[TD]CP,00001[/TD]
[/TR]
[TR]
[TD]Date,15/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="align: right"]85[/TD]
[/TR]
[TR]
[TD="align: right"]24[/TD]
[/TR]
[TR]
[TD="align: right"]32[/TD]
[/TR]
[TR]
[TD="align: right"]1485[/TD]
[/TR]
[TR]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]101[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]87[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]CP,00502[/TD]
[/TR]
[TR]
[TD]Date,14/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]69[/TD]
[/TR]
[TR]
[TD="align: right"]35[/TD]
[/TR]
[TR]
[TD="align: right"]78.6[/TD]
[/TR]
[TR]
[TD="align: right"]36.9[/TD]
[/TR]
[TR]
[TD="align: right"]85.8[/TD]
[/TR]
[TR]
[TD="align: right"]8569.5[/TD]
[/TR]
[TR]
[TD="align: right"]78.9[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]874[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]CP,04003[/TD]
[/TR]
[TR]
[TD]Date,19/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD="align: right"]52[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[/TR]
[TR]
[TD="align: right"]47[/TD]
[/TR]
[TR]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]69[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]CP,90004[/TD]
[/TR]
[TR]
[TD]Date,16/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]36[/TD]
[/TR]
[TR]
[TD="align: right"]7.3[/TD]
[/TR]
[TR]
[TD="align: right"]3.6[/TD]
[/TR]
[TR]
[TD="align: right"]36[/TD]
[/TR]
[TR]
[TD="align: right"]58[/TD]
[/TR]
[TR]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="align: right"]21[/TD]
[/TR]
[TR]
[TD]CP,00035[/TD]
[/TR]
[TR]
[TD]Date,1/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]78.6[/TD]
[/TR]
[TR]
[TD="align: right"]36.9[/TD]
[/TR]
[TR]
[TD="align: right"]85.8[/TD]
[/TR]
[TR]
[TD="align: right"]8569.5[/TD]
[/TR]
[TR]
[TD="align: right"]78.9[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]874[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]CP,99006[/TD]
[/TR]
[TR]
[TD]Date,12/06/2014[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]87[/TD]
[/TR]
[TR]
[TD="align: right"]96[/TD]
[/TR]
[TR]
[TD="align: right"]66[/TD]
[/TR]
[TR]
[TD="align: right"]55[/TD]
[/TR]
</tbody>[/TABLE]
and I want it to be in this form

[TABLE="width: 844"]
<tbody>[TR]
[TD]CP,00001[/TD]
[TD]Date,15/06/2014[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]85[/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]1485[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]101[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]87[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]CP,00502[/TD]
[TD]Date,14/06/2014[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]69[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]78.6[/TD]
[TD="align: right"]36.9[/TD]
[TD="align: right"]85.8[/TD]
[TD="align: right"]8570[/TD]
[TD="align: right"]78.9[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]874[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]CP,04003[/TD]
[TD]Date,19/06/2014[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]52[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]47[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]69[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]CP,90004[/TD]
[TD]Date,16/06/2014[/TD]
[TD="align: right"]36[/TD]
[TD="align: right"]7.3[/TD]
[TD="align: right"]3.6[/TD]
[TD="align: right"]36[/TD]
[TD="align: right"]58[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]21[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]CP,00035[/TD]
[TD]Date,1/06/2014[/TD]
[TD="align: right"]78.6[/TD]
[TD="align: right"]36.9[/TD]
[TD="align: right"]85.8[/TD]
[TD="align: right"]8570[/TD]
[TD="align: right"]78.9[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]874[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]9[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]CP,99006[/TD]
[TD]Date,12/06/2014[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]87[/TD]
[TD="align: right"]96[/TD]
[TD="align: right"]66[/TD]
[TD="align: right"]55[/TD]
[TD="align: right"]87[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I will be very grateful if some one could help me with the VBA code for this.
Thanks in advance
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
why do you need the values in a row?

If you want to analyze the data, (e.g. with an pivot table) a verticaly format is much better.
 
Upvote 0
why do you need the values in a row?

If you want to analyze the data, (e.g. with an pivot table) a verticaly format is much better.

Hi,
I have several hundreds of files in this format and I want to organise it into a database... in row format.
Thanks
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

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