[英]Creating a table from the output of advanced filter copy
I managed to use AdvancedFilter to only copy certain data that meets my criteria to a existing worksheet using the following snippet.我设法使用 AdvancedFilter 仅将符合我的条件的某些数据复制到使用以下代码段的现有工作表中。
Sheets("MyDataSheet").Range("MainTable[#All]").AdvancedFilter _
Action:=xlFilterCopy, CriteriaRange:=Sheets("Criteria").Range( _
"Criteria[[#All],[MyFilter]]"), CopyToRange:=Range("Test!Extract"), _
Unique:=False
However, on that sheet is an existing table.但是,该表上有一个现有表。 When i run this macro the correct data is copied but it isn't a table.
当我运行此宏时,会复制正确的数据,但它不是表格。 Can somebody help me convert the output to a table with a specified name.
有人可以帮我将 output 转换为具有指定名称的表。
Status is that there is already a table with that name (target name: "FilteredTable").状态是已经有一个具有该名称的表(目标名称:“FilteredTable”)。 table can be emptied and than pasted with the new filtered data.
表可以被清空,然后粘贴新的过滤数据。
Try something like this:尝试这样的事情:
With ThisWorkbook.Sheets("Test")
.ListObjects.Add(xlSrcRange, _
.Range("Extract").CurrentRegion, , xlYes).Name = "Blah"
End With
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.