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
 

Gtabtr1

New Member
Joined
Feb 15, 2017
Messages
39
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!
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
50,563
Office Version
  1. 365
Platform
  1. Windows
Glad you sorted it & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,134
Messages
5,570,364
Members
412,321
Latest member
Yusuf_A
Top