Scenario
I have an excel sheet with a lot of values. I am using some macro to filter those values.
What I need
I need to copy only the filtered values from current sheet to another sheet. I am doing the following way
Sub filterCopy()
Selection.SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Issue
The above code doing exactly what is supposed to do by copying only the visible cells. But the problem is, it is copying entire sheet including all the blank cells upto row number 1048480 and even more. But my data is only upto row number 12. How should I copy only the visible cells that contains data and not all those blank cells?
Pictures