Filter by specific header text

Milos

Board Regular
Joined
Aug 28, 2016
Messages
115
Hi all,

I am trying to filter for blanks on a specific column header and I am struggling to get my head around it/could not find any solution on the net relevant for this issue. I need to use this on about 30 different sheets and every single worksheet has the same text ("Received Progress") in slightly different columns so setting which column is not feasible.

Ideally the code should look similar to this (albeit with the "Received Progress" probably converted into a Dim that will work correctly):

Code:
ActiveSheet.Rows(2).AutoFilter
ActiveSheet.Rows(2).AutoFilter Field = "[COLOR=#ff0000]Received Progress[/COLOR]", Criteria1:="="
Can anybody please help? It will save me a good 4 hours of applying filters.
Cheers,
Milos
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
40,719
Office Version
365
Platform
Windows
Try
Code:
   Dim fnd As Range
   Set fnd = Range("2:2").Find("Received Progress", , , xlWhole, , , False, , False)
   If Not fnd Is Nothing Then
      ActiveSheet.Rows(2).AutoFilter
      ActiveSheet.Rows(2).AutoFilter Field = fnd.column, Criteria1:="="
   End If
 

Milos

Board Regular
Joined
Aug 28, 2016
Messages
115
Thanks Fluff!

I have added that into the rest of my code. Exactly what I needed!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
40,719
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,099,122
Messages
5,466,821
Members
406,500
Latest member
Tknotmaxx

This Week's Hot Topics

Top