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:


Last nameAgeFirst nameID numberLocationDate

<tbody>
</tbody>

Re-arranged into:

First nameLast nameAgeIDDateLocation

<tbody>
</tbody>


Thank you for taking your time to read!



 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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,216,059
Messages
6,128,542
Members
449,457
Latest member
ncguzzo

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