Autofilter with headers in Row 2

Gtabtr1

New Member
Joined
Feb 15, 2017
Messages
39
I'm sure this is a simple answer but I'm fairly frustrated trying to get it to work and not being able to identify why it is not working. My data headers are in row 2. Most of Row 1 is empty, out of 16 used columns, only 2 have data. But I need my autofilter to use row 2 are the header row. I'm getting the dreaded "Autofilter method of range class failed". Please! Please! What am I missing?

Dim AreaList As Range
Dim area As Range
Set AreaList = Workbooks(Pretty).Sheets(List).Range("A2:A" & last)

Workbooks(Master).Sheets(Participants).Activate
Workbooks(Master).Sheets(Participants).Select
Dim RangetoFilter As Variant
Dim Headerrow As Variant
RangetoFilter = "A3:P" & Lastrow
Headerrow = "A2:P2"
For Each area In AreaList

ActiveSheet.AutoFilterMode = False
ActiveSheet.Range(Headerrow).Select
ActiveSheet.Range(Headerrow).AutoFilter
ActiveSheet.Range(RangetoFilter).AutoFilter Field:=5, Criteria1:=area, Operator:=xlFilterValues
 
No, nothing special.

I ended up deleting row 1, making my header row row 1 instead of row 2. I'll just have to find another place for the data that was in row 1. Simple work-around but very frustrating to try and find an actual solution. I really appreciate your help. Thank you!
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,866
Messages
6,121,996
Members
449,060
Latest member
mtsheetz

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