I want to copy a table from one workbook to another. The copied table will then become the source data for a pivot table, so I would like it to stay a table, instead of just being pasted data.
When I try it with the macro recorder I get this:
The problem is that this does not paste the headers of the table; just the data.
I can copy the table with the headers too like this:
...but that strikes me as rather clumsy.
Surely there is a way to tell VBA to just copy the entire table, including the headers?
Or perhaps there is some higher-level functionality for just copying a table between two workbooks, and I'm just missing the big picture?
Thanks!
When I try it with the macro recorder I get this:
Code:
Sub copyTable()
Application.Goto Reference:="EstimatesData"
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
End Sub
The problem is that this does not paste the headers of the table; just the data.
I can copy the table with the headers too like this:
Code:
Range("EstimatesData[[#Headers],[FirstColumn]]").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
...but that strikes me as rather clumsy.
Surely there is a way to tell VBA to just copy the entire table, including the headers?
Or perhaps there is some higher-level functionality for just copying a table between two workbooks, and I'm just missing the big picture?
Thanks!