Update: Added missing ‘Sub End’
On Excel 2010, I created this VBA to copy data from a specific column on a specific table to another table on another spreadsheet to editing the values later without disturbing the original source data.
I am posting it here since I had to do multiple searches for the syntax.
-
Sub copyColumn()
'Delete current values prior to paste if values exist
If Application.WorksheetFunction.CountA(Range("Table2[Column1]")) <> 0 _
Then Range("Table2[Column1]").Delete
'Select desired column to copy with destination option
Range("Table1[[Column3]]").Copy _
Destination:=Range("Table2[[Column1]]")
Sub End
If you find this snippet of code useful, leave a comment.