Filtering Using VBA, can get rid of first row

Stevep4

New Member
Joined
Aug 28, 2015
Messages
35
I have the below code that goes to sheet OnOrder, filters for the data in cells F2 and A2 in the HOME tab and then copies that data and pastes in into cell AU17 in the APR tab. The problem is that when it pastes the data it's taking exactly what I need AND the first row. In this case row 2. So if I want various rows based on my criteria, I can get them but they also include row 2. Is there any way I can just grab what I want. Basically, it's looking at the first row, filtering, and then pulling in that first row along with everything else.

VBA Code:
Sub SaveDatatoMonthA2()
 Worksheets("HOME").Activate
Dim wkb1 As Workbook
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Set wkb1 = ThisWorkbook
Set sht1 = wkb1.Sheets("OnOrder")
Set sht2 = wkb1.Sheets("APR")
'sht2.Range("A2:AF150000").ClearContents
With sht1.Range("a2:r90000")
   .AutoFilter Field:=2, Criteria1:=[F2]
  .AutoFilter Field:=6, Criteria1:=[A2]
    .SpecialCells(xlCellTypeVisible).Copy Destination:=sht2.Range("AU17")
    .AutoFilter
End With
End Su

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How about
VBA Code:
.AutoFilter.Range.Offset(1).Copy Destination:=sht2.Range("AU17")
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top