大家好,我正在努力使这段代码有效
`For Each dest In destSS
Hoja8.ListObjects("BD").range.AutoFilter Field:=9, Criteria1:= _
Array(dest), Operator:=xlFilterValues
With Hoja8.ListObjects("BD").Sort
.SortFields.Clear
.SortFields.Add Key:=range("BD[Load Status]"), Order:=xlDescending
.SortFields.Add Key:=range("BD[Destination]"), Order:=xlAscending
.SortFields.Add Key:=range("BD[Current Location]"), Order:=xlAscending
.SortFields.Add Key:=range("BD[Event]"), Order:=xlAscending
.SortFields.Add Key:=range("BD[Dwell]"), Order:=xlDescending
.Apply
End With
On Error Resume Next
Set myRange = sheet8.ListObjects("BD").DataBodyRange.SpecialCells(xlVisible)
On Error GoTo 0
If myRange Is Nothing Then
'Do nothing
Else
'do stuff`
它运行良好,但是当去过滤的数据没有显示任何内容时,它仍然复制标题,当我输入 -1 时,它根本不复制任何数据,你能帮我吗?谢谢!
我试过这段代码并运行但是当过滤器在行上没有显示任何内容时仍然复制标题