Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Excel Autofilter problem

Posted on 2013-10-25
2
319 Views
Last Modified: 2013-10-27
Hi, I do a Daily Rec which means I have to auto-filter a list in an Excel spreadsheet and I copy and paste the contents to another spreadsheet. How can I exclude copying the top row of the block when I am copying and pasting (which are essentially just headings)? here's the code I currently use:

lr = Cells(Rows.Count, "A").End(xlUp).Row

Rows("3:3").Select
    Selection.AutoFilter
    ActiveSheet.Range("$A$3:$R$" & lr).AutoFilter Field:=13, Criteria1:=">=1", _
        Operator:=xlOr, Criteria2:="<=-1"


    Range("A3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
0
Comment
Question by:Justincut
2 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39600002
Change

Range("A3").Select

to

Range("A4").Select
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 39600178
You can skip the selecting:

   ActiveSheet.AutoFilterMode = False
   LR = Cells(Rows.Count, "A").End(xlUp).Row

   With ActiveSheet.Range("$A$3:$R$" & LR)
      .AutoFilter Field:=13, Criteria1:=">=1", _
        Operator:=xlOr, Criteria2:="<=-1"
        ' check there are matching cells
        If .Columns(1).SpecialCells(xlCellTypeVisible).Count > 1 Then .Offset(1).Resize(.Rows.Count - 1).Copy
   End With

Open in new window

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My experience with Windows 10 over a one year period and suggestions for smooth operation
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question