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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
Please post an example of your actual data with an example of expected results !!!!
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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