Using Filters, Copy + Paste in a Macro #2

  • Thread starter Thread starter Andy W
  • Start date Start date
A

Andy W

I received the below reply (which I am very grateful
for!!), however this seems to copy the top line of the
filter, i.e. Header row, as well as the data I actually
want to copy.

Is there any way I can just select the data, and now the
header row?

Yours Hopefully,

Andy

*******************************
Andy,

Replace

Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="PB to Cust*"
Range("A2:F1001").Select
Selection.Copy

with

With Range("A2").CurrentRegion
.AutoFilter Field:=2, Criteria1:="13"
.SpecialCells(xlVisible).Copy
.Copy
End With

HTH,
Bernie
MS Excel MVP

message
news:[email protected]...
 
Dim rng as Range
Sheets("Raw Data").Activate
If ActiveSheet.AutofilterMode then Activesheet.AutofilterMode = False
With Range("A2")
.AutoFilter Field:=2, Criteria1:="PB to Cust*"
End with
With Activesheet.Autofilter.Range
set rng = .offset(1,0).Resize(.rows.count-1)
End With
rng.copy Destination:=Sheets("CustbyRDC").Range("A7").

if your table actually starts in A1 with a header row, change A2 above to
A1.
 
Back
Top