Unfilter only the active column


New Member
Dear Forum members

Looking for some help here, I am relatively new to VBA so this might be elementary for some of you, although I do not know how to do it

I have a large Excel spreadsheet with about 6000+ rows and 25+ columns
I have filtered all the column headings using Data > Filter

For analysis, I often filter the spreadsheet on several columns based on search criteria.

Sometimes I want to UnFilter only one column - the active one that my selected cell is at.

I know I can do that by clicking the filter drop down for that heading and checking "Select All", but that is several clicks and slows me down

I was wondering if there is a VBA macro so I can create a button on my Quick Access Toolbar so whenever I click it, the column of the active cell gets unfiltered without disturbing any of the filters on the remaining columns.

I did a Google search and there are several suggestions in many Excel forums, but they all require a specific column to be called out (Field:6, for example) for unfiltering as part of the code

I work with several spreadsheets, with similar analysis. Not always I want to unfilter the same column and not always are the spreadsheets the same.

Basically what I am looking for is a VBA macro that first identifies the column of my active cell, then if that column is filtered, it executes a "Select All" command on that column only. I can then create a button on the QAT and link it to that macro.

Thanks in advance for support


Well-known Member

Try this:

<code>Sub RemoveActiveFilter()

Dim FilterNum As Long
Dim FilterRange As Range

Set FilterRange = ActiveCell.CurrentRegion

If Not Intersect(ActiveCell, FilterRange) Is Nothing Then
    FilterNum = Intersect(ActiveCell, FilterRange).Column - FilterRange.Column + 1
    FilterRange.AutoFilter Field:=FilterNum
End If

End Sub</code>
Last edited:

Some videos you may like

This Week's Hot Topics

  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • find many based on a certain criteria
    good evening, I hope someone can help me? I have a workbook sheet 2 contains lots of data.... I would like to be able to find anything on sheet...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
  • Text Format
    I have a sheet for user to keyin the data. The format of the data can be 451 / 1903, 0012 / 9908 or 00287 / 0099. The number after the "/" is...
  • Macro to copy values across rows and transposing them and add the user id
    [FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT][FONT=Calibri][SIZE=3][COLOR=#000000]Hi,[/COLOR][/SIZE][/FONT] [FONT=Times New...