Below is the code. According to scores of articles, CopyRange.SpecialCells(xlCellTypeVisible).Copy followed by DestinationRange.PasteSpecial should only copy the visible rows. However it copies ALL the rows.
All the work-around articles say, NO PROBLEM - just loop through EACH row of data.
Is there a way to copy ONLY the visible rows as a range?
![]()
Sub CopyRanges(IsMatch As Boolean) Dim shC As Worksheet ' Source worksheet (Connections) Dim shD As Worksheet ' Destination worksheet Dim LRowD As Long ' Last row destination sheet Set shC = Sheets("Connections") ClearFilter shC.Name, "Table_Connections" Select Case IsMatch Case True Set shD = Sheets("Match") ClearTable shD.Name, "Table_Match" Case False Set shD = Sheets("No Match") ClearTable shD.Name, "Table_No_Match" End Select shC.ListObjects("Table_Connections").Range.AutoFilter Field:=6, Criteria1:=IsMatch shC.Range("Table_Connections[#Data]").SpecialCells(xlCellTypeVisible).Copy shD.Range("$A$2").PasteSpecial End Sub
Bookmarks