I have an excel file with 10 sheets. The sheets all contain the same column headers but different data. I sorted the first sheet manually and now I want all the columns in the other sheets to match the first sheet's order, I can't do them all manually because it would take me forever. How can I make all the columns across the workbook in the same order based on the first sheet order? I know little about VBA so looking for some help.
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
If you're looking to repeat the re-ordering of columns, you should be able to record a simple macro for this, as long as the columns in all the sheets are in the same (wrong) order. Open the second sheet (since you already arranged the first), and do the following:
record macro
, give it any namestop recording
Now you have a macro that you can open the rest of the pages, and it will repeat your re-ordering. Open each sheet and click View Macros, then run the one you just created. If you save the file, it will save the macro as well.
EDIT: Excellent point by @horaciux, be sure to save the entire workbook before running a macro, since there is no undo.
Make sure you save the entire workbook before running a macro. There is no undo.
Hope this help: