Macro for relocating non adjacent columns

MelanieGuinot

New Member
Joined
Feb 18, 2016
Messages
3
Hello to All!

I have a data with more than 500 columns in excel xlsx file. the columns are like this:

A1 A2 A3... A15 B1 B2.... B15 C1 C2 C15... and so on. I like to relocate columns in such a way that it is A1B1C1D1...then A2B2C2...etc. Is there a macro that can do this relocation. Since there are more than 500 columns, copy paste is tedious. I am looking forward for your insight!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Perhaps:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG18Feb42
ActiveSheet.Range("A1").CurrentRegion.Copy
Sheets("Sheet2").Range("A1").PasteSpecial Transpose:=True
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 

MelanieGuinot

New Member
Joined
Feb 18, 2016
Messages
3
Hi Mick, Thanks for your code. However, i think i did not explain clearly :rolleyes:. I have attached a structure of my data.

CURRENT:

A1A2A3B1B2B3C1C2C3
143579847
334680648

<tbody>
</tbody>

Want to move columns and their data like this.

A1B1C1A2B2C2A3B3C3
158474397
366384408

<tbody>
</tbody>


There are 10000 rows totally. and columns spread from A1 to A35 and the B1 to B35 like that 560 columns

Thank you
 

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Do these refer to header text for each column ??? :- A1 A2 A3 B1 B2 B3 C1 C2 C3
 

MelanieGuinot

New Member
Joined
Feb 18, 2016
Messages
3
The actual header is like this HVIDX$01 HVIDX$02... then HV101$01 HV101$02... The common identifier is last three char $01 or $02 etc. so the header with last three char $01 should all be adjacent followed by $02.
 

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Please post an example of your actual data with an example of expected results !!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,130,169
Messages
5,640,545
Members
417,151
Latest member
ChickenTenderer

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
Top