[英]Excel Vba: Sub or Function not defined
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). 我要完成的事情是将一列从一个表复制到另一张表中的另一个表列(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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.