I have the following code
Sub CopyMacro()
'
' CopyData Macro
'
Dim tableName As ListObject
Set tableName = Worksheets("ToCopySheet").ListObjects(1)
ListObjects("Table1").ListColumns("TaskUID").DataBodyRange.Copy tableName.ListColumns("TaskUID").DataBodyRange
End Sub
When I try to run this I get a compile error. Sub or Function not defined. I do not understand the issue here as I don't see anything wrong in this syntax.
The thing I'm trying to accomplish is to copy one column from one table to another table column in another sheet (ToCopySheet).
Could someone please help resolve this error
Maybe you mean
Sub CopyMacro()
'
' CopyData Macro
'
Dim tableName As ListObject
Set tableName = Worksheets("ToCopySheet").ListObjects(1)
Dim ws As Worksheet
Set ws = ActiveSheet
ws.ListObjects("Table1").ListColumns("TaskUID").DataBodyRange.Copy tableName.ListColumns("TaskUID").DataBodyRange
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.