Skopiuj filtrowaną tabelę do innego arkusza roboczego w programie Excel

view sourceprint?
'Name macro
Sub CopyFilteredTable()
 
'Dimension variables and declare datatypes
Dim rng As Range
Dim WS As Worksheet
 
'Go through rows in Table2
For Each Row In Range("Table2[#All]").Rows
 
    'Check if row is visible
    If Row.EntireRow.Hidden = False Then
 
        'The SET statement allows you to save an object reference to a variable, the image above demonstrates a macro that assigns a range reference to a range object.
        If rng Is Nothing Then Set rng = Row
 
        'Returns the union of two or more ranges.
        Set rng = Union(Row, rng)
    End If
 
'Continue with next row
Next Row
 
'Create a new worksheet
Set WS = Sheets.Add
 
'Copy rng to cell A1 in worksheet WS
rng.Copy Destination:=WS.Range("A1")
End Sub
ShowGo Shane