Resequencing for SQL

Pokystick

New Member
Joined
Apr 27, 2017
Messages
1
Hi,

I'm currently doing a lot of re-arrangements for columns in Excel. It has to be in a particular order before I send it for processing and the arrangement of the column are in another spreadsheet with the exact name.

Is there any way to re-arrange them automatically using macros?

For example:


[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Last name[/TD]
[TD]Age[/TD]
[TD]First name[/TD]
[TD]ID number[/TD]
[TD]Location[/TD]
[TD]Date[/TD]
[/TR]
</tbody>[/TABLE]

Re-arranged into:

[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]First name[/TD]
[TD]Last name[/TD]
[TD]Age[/TD]
[TD]ID[/TD]
[TD]Date[/TD]
[TD]Location[/TD]
[/TR]
</tbody>[/TABLE]


Thank you for taking your time to read!



 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the Board!

Yes, if you turn on your Macro Recorder and record yourself moving the columns around your desired format, you will have recorded VBA code that will do that for you that you can use to automate the process.
You can clean up the code if you want to make it a little more efficient (the Recorder records unnecessary things like Selections and Scrolls), but the code will work regardless.
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
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