I have a process which maps columns from one sheet to another within the same workbook driven by a Field (/Column) mapping table.
The table contains source column number and name and target column number and name.
Earlier versions of code used a combination of range/cells notation to successfully map from input to output.
As the target table is ultimately defined as a ListObject I thought about having the transfer code:
1. Use conventional Range techniques to add and copy in the first column.
2. Based on this single column range, create and name a ListObject.
3. Thereafter add a new column (via ListColumns(n).add)
4. Give the new column a name
5. Copy using ListColumns.DataBodyRange references for both source and target columns copy or Copy/Paste the data to the new column
The process fails at stage 5. I have checked the column references in 'Locals' and using 'mouse-over'.
The defined listobject target table in the physical sheet is recognised and the column named as expected. It is in Column 2 as expected.
There MAY be something missing in the syntax and have tried an extra .Range but to no avail.
Code snippet:
Hope someone out there can helpPlease Login or Register to view this content.
NDG1944
Bookmarks