MwTV
MIS
- Mar 9, 2007
- 99
Hopefully, this can be done;
Occasionally, I run complex queries and drop the result in Excel templates.
Problem is when the order of columns in the query result do not coincide with the column headings in the Excel templates. Therefore, I have to manually cut and paste the columns in the query result to coincide with the columns in the Excel template.
Question - Is it possible to enter the column headings in column "A" of a worksheet and have a macro or vba to rearrange the columnar data that is in columns B through O so that the columns now coincide with the order of the data in column "A?"
For example, if I have the following entered in column A;
Dog
Cat
Horse
and I have the columns in my query result set like
Cat
Horse
Dog
My desired result would be for the columns in my query result set to be
Dog
Cat
Horse
Thanks in advance.
Occasionally, I run complex queries and drop the result in Excel templates.
Problem is when the order of columns in the query result do not coincide with the column headings in the Excel templates. Therefore, I have to manually cut and paste the columns in the query result to coincide with the columns in the Excel template.
Question - Is it possible to enter the column headings in column "A" of a worksheet and have a macro or vba to rearrange the columnar data that is in columns B through O so that the columns now coincide with the order of the data in column "A?"
For example, if I have the following entered in column A;
Dog
Cat
Horse
and I have the columns in my query result set like
Cat
Horse
Dog
My desired result would be for the columns in my query result set to be
Dog
Cat
Horse
Thanks in advance.