PDA

View Full Version : Solved: Copy/Import based on Column Header Name



JimS
06-02-2009, 01:49 PM
I have a very large .sv file that is my data source. There are over 200 Columns in it. I only need to copy (or import) a few of the columns into a xlt template.

The criteria used to determine if I a particular column should be copied is based on the Column Heading Name.

Here are a few examples (only a few examples) of how the columns might be labeled:

Run1\Red(abc0)\data1
Run1\Red(abc0)\data2
Run1\Red(abc0)\data3
Run1\Red(abc0:2)\data1
Run1\Red(abc0:2)\data2
Run1\Red(abc0:2)\data3
Run1\Red(abc32)\data1
Run1\Red(abc32)\data2
Run1\Red(abc32)\data3
Run1\Red(abc32:4)\data1
Run1\Red(abc32:4)\data2
Run1\Red(abc32:4)\data3

I only want to copy/import the columns with Headings that only have abc0 with no :0 or :2 or :4 (no colon with an additional number).

Can a macro scan the Headings for a particular pattern and then copy the entire column and paste it into another workbook?

I only need to focus on the abcx (x being any number), everything before or after the () can be anything, but the (abcx) is a constant (again with x being any number).

Thanks for any help...

Jim