Excel - Macro to rearrange/add columns in all the sheets based oncolumn header
What about the sort function Data/Sort prior to xl2007. I recorded a
macro while doing this:
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight
Presumably you could loop through all the sheets of interest and run
this code for each. You'd need to determine the size of your data
range in each sheet (or is it always the same?). Post back if this is
close to what you were looking for and I'll develop it a bit further.
Rgds,
Andrew
On Feb 17, 1:34*pm, avi wrote:
Hi,
I need to rearrange columns on many sheets in a certain order based on
on column header.
For example, my columns might come into my spreadsheet as
C,B,D,G,A,H,I,F , or as F,B,C,A,D *etc.
I want them all sorted say A,B,C,D - the rest of the columns is
irrelevant.
How do I accomplish this ?
TIA
|