Need macro for copying values from single column and pasting in multiple columns

moramramesh

New Member
Joined
May 22, 2019
Messages
17
Hi All,

I need macro for the below task.
I need to copy each set of data under each header from column B to column D, column E, and so on.

[TABLE="width: 138"]
<colgroup><col span="2"></colgroup><tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[/TR]
[TR]
[TD]Server1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Header1[/TD]
[TD]Header2[/TD]
[/TR]
[TR]
[TD]Date1[/TD]
[TD]Value1[/TD]
[/TR]
[TR]
[TD]Date2[/TD]
[TD]Value2[/TD]
[/TR]
[TR]
[TD]Date3[/TD]
[TD]Value3[/TD]
[/TR]
[TR]
[TD]Date4[/TD]
[TD]Value4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Server2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Header1[/TD]
[TD]Header2[/TD]
[/TR]
[TR]
[TD]Date1[/TD]
[TD]Value1[/TD]
[/TR]
[TR]
[TD]Date2[/TD]
[TD]Value2[/TD]
[/TR]
[TR]
[TD]Date3[/TD]
[TD]Value3[/TD]
[/TR]
[TR]
[TD]Date4[/TD]
[TD]Value4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Server3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Header1[/TD]
[TD]Header2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Server4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Header1[/TD]
[TD]Header2[/TD]
[/TR]
[TR]
[TD]Date1[/TD]
[TD]Value1[/TD]
[/TR]
[TR]
[TD]Date2[/TD]
[TD]Value2[/TD]
[/TR]
[TR]
[TD]Date3[/TD]
[TD]Value3[/TD]
[/TR]
[TR]
[TD]Date4[/TD]
[TD]Value4[/TD]
[/TR]
</tbody>[/TABLE]

Target state (I want the above values from col B to be pasted to col D, col E etc in horizontal direction to plot the graph):
[TABLE="width: 275"]
<colgroup><col><col span="2"><col></colgroup><tbody>[TR]
[TD]Column D[/TD]
[TD]Column E[/TD]
[TD]Column F[/TD]
[TD]Column G[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Header2[/TD]
[TD]Header2[/TD]
[TD]Header2[/TD]
[TD]Header2[/TD]
[/TR]
[TR]
[TD]Value1[/TD]
[TD]Value1[/TD]
[TD][/TD]
[TD]Value1[/TD]
[/TR]
[TR]
[TD]Value2[/TD]
[TD]Value2[/TD]
[TD][/TD]
[TD]Value2[/TD]
[/TR]
[TR]
[TD]Value3[/TD]
[TD]Value3[/TD]
[TD][/TD]
[TD]Value3[/TD]
[/TR]
[TR]
[TD]Value4[/TD]
[TD]Value4[/TD]
[TD][/TD]
[TD]Value4[/TD]
[/TR]
</tbody>[/TABLE]



Note: There are empty rows between server names and headers. Also there are empty rows between values and server names
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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