VBA存在任何好的和有效的方式来更改一个表,其中应用了许多过滤器以删除所有其他无关的数据(未被过滤)?目标是从xlsm中删除不需要的数据。感谢。
答案 0 :(得分:0)
这是你想要的吗?
Sub DropHidden()
Dim EquivRange As Range, r As Range
Dim lo As ListObject
Dim nFirstRow As Long, nLastRow As Long
Set lo = ActiveSheet.ListObjects(1)
With lo
Set EquivRange = .DataBodyRange
nFirstRow = EquivRange.Row
nLastRow = EquivRange.Rows.Count + EquivRange.Row - 1
For i = nLastRow To nFirstRow Step -1
Set r = Cells(i, 1).EntireRow
If r.Hidden Then
r.Delete
End If
Next i
.Unlist
End With
End Sub