Copy/Paste from a filter

Mashtonsmith

Board Regular
Joined
Oct 1, 2004
Messages
164
Hello...

I'm sure this has a simple answer..

I'm trying to copy and paste from a large filtered workbook.

When I paste all the rows that the filter removes are pasted also.

How can I just copy and paste the filtered selection?

Thanks
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

John Davis

Well-known Member
Joined
Sep 11, 2007
Messages
3,457
Hello...

I'm sure this has a simple answer..

I'm trying to copy and paste from a large filtered workbook.

When I paste all the rows that the filter removes are pasted also.

How can I just copy and paste the filtered selection?

Thanks

Maybe something like this?

Code:
Sub Mashtonsmith()
Dim lr As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row
'
    Columns("B:B").AutoFilter
    Selection.AutoFilter Field:=1, Criteria1:="YOUR CRITERIA"
    Range("A2:C" & lr).EntireRow.SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet2").Range("A1")

End Sub
 

Mashtonsmith

Board Regular
Joined
Oct 1, 2004
Messages
164
Thanks for responding John

I was hoping for a simpler answer! Is there not a paste or copy function that can do this?
 

John Davis

Well-known Member
Joined
Sep 11, 2007
Messages
3,457
Thanks for responding John

I was hoping for a simpler answer! Is there not a paste or copy function that can do this?


I've never had that problem with filtered data. I only select the range, copy and paste. Only the visible cells are copied and pasted. Therefore I don't know why that doesn't work for you.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,444
Messages
5,528,798
Members
409,835
Latest member
Mafu1267

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top