View Full Version : Solved: Copy only filtered rows
Hi all,
I am looking for same code to copy only the filtered rows of a column, after the use of the Excel filter.
Infact if one use the usual copy and paste option this selects all the rows of the column and not only the filtered rows.
Thanks for any help
Sasa
Bob Phillips
05-09-2008, 01:50 PM
You need Specialcells(xlCellTypeVisible).
What is the column being filtered, and what is being copied?
david000
05-09-2008, 07:15 PM
You can also filter then select the data you need and press.
Alt + ;
The Alt key and the semicolon that will also select just thte data you need or as xld said Visible Cells Only.
Well, for examplea
A1= a
B1= b
C1 = c
d1 = a
If I filter by a
then the filterd rows are only a1 and d1 (two rows) but if I use copy ad past on these two showed rows excel does not let me to copy only these filtered rows but I have to copy and past the four rows at all.
Thanks
Simon Lloyd
05-10-2008, 04:15 PM
Try this:
Sub Copy_filtered_range()
Dim Rng As Range
Set Rng = Cells.SpecialCells(xlCellTypeVisible)
Rng.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
It copies what is visible after you have filtered and pastes it to the next available row in sheet 2.
Your solution is great !
Thanks
sasa
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.