Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

 How to apply same filter to multiple sheets In Excel?

It may be easy for us to apply the Filter function to filter data in a worksheet, but, sometimes, you may need to filter across multiple worksheets which have common data formatting with the same filter criteria. To filter them one by one will waste lots of time, here, I can introduce an easy way to solve it at once.

Apply same filter to multiple worksheets with VBA code


Filter data by multiple criteria or other specific condition, such as by text length, by case sensitive, etc.

Kutools for Excel’s Super Filter feature is a powerful utility, you can apply this feature to finish the following operations:

  • Filter data with multiple criteria;              Filter data by text length;
  • Filter data by upper / lower case;             Filter date by year / month / Day / week / quarter

doc-super-filter1

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


arrow blue right bubble Apply same filter to multiple worksheets with VBA code


For example, I have four worksheets as following screenshot need to be filtered with the same criteria that the Product = KTE at once.

doc filter multiple sheets 1

There is no direct way to filter data in multiple sheets in Excel, but, the following VBA code can help you to finish this job, please do as follows:

1. Hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Apply same filter to multiple worksheets:

Sub apply_autofilter_across_worksheets()
'Updateby Extendoffice 20160623
    Dim xWs As Worksheet
    On Error Resume Next
    For Each xWs In Worksheets
        xWs.Range("A1").AutoFilter 1, "=KTE"
    Next
End Sub

3. And then press F5 key to run this code, all products of KTE have been filtered in all worksheets at once, see screenshot:

doc filter multiple sheets 2

Note: Within above code, in this xWs.Range("A1").AutoFilter 1, "=KTE" script, A1 and =KTE indicates the column and criteria which you want to filter based on, the number 1 is the column number you filtered based on, you can change them to your need. For example, if you want to filter the order greater than 50, you just need to modify this script as this: xWs.Range("B1").AutoFilter 2, ">50".


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    berenice · 8 months ago
    how to eliminate filtered rows?
  • To post as a guest, your comment is unpublished.
    Sibi · 1 years ago
    How to use "Filter Between" Function, for the same multiple sheets?

    (Example: Time range)
  • To post as a guest, your comment is unpublished.
    Suyash · 1 years ago
    Can we use cell name like Product instead of A1 in : xWs.Range("A1").AutoFilter 1, "=KTE"
    I have different column and some names comes in different column.
    • To post as a guest, your comment is unpublished.
      Suyash · 1 years ago
      I have used filter in every sheet. And I want to change s.no from 1 2 3 serially in every sheet after filter.


      Please let me know if you have vba code for it
  • To post as a guest, your comment is unpublished.
    jarred · 1 years ago
    HI, does the super filter across the entire workbook automatically reapply whenever theres an update of the file?
  • To post as a guest, your comment is unpublished.
    Sebastian · 1 years ago
    Thank you for the code!! is there a way to change the "=KTE" to use a value from a List or Drop down list?
  • To post as a guest, your comment is unpublished.
    Matthew · 1 years ago
    Is there a way to change the "=KTE" part for each sheet with a contain filter that is based on the sheet's name?
  • To post as a guest, your comment is unpublished.
    Monika · 1 years ago
    Hi,


    How this works if Product column is presented in different places in other sheets ?


    In sheet1, it is A1 in sheet2 it is in B1 and in sheet3 it is A1 again ?

    Thanks,
    Monika
  • To post as a guest, your comment is unpublished.
    Mahesh · 1 years ago
    Is there any option to filter by colors?
  • To post as a guest, your comment is unpublished.
    Justin · 1 years ago
    Can I use this to filter pivot tables in multiple sheets if all the pivots tables are from same data source and set up using same criteria?
  • To post as a guest, your comment is unpublished.
    donovan · 1 years ago
    How can you use the result of the auto-filter to set the filter for each other sheet instead of using =(specific name)
  • To post as a guest, your comment is unpublished.
    Donovan Hubbart · 1 years ago
    How do execute if the filter is on a different column on each sheet?
  • To post as a guest, your comment is unpublished.
    Grace · 2 years ago
    Hi,


    My data is in Column E and when I apply this filter with Range("E1") it still filters column A


    How can I troubleshoot?
    Thanks
    • To post as a guest, your comment is unpublished.
      VBA · 1 years ago
      You just have to write the Column number in AutoFilter, in this case: xWs.Range("E1").AutoFilter 5,
  • To post as a guest, your comment is unpublished.
    KABILAN · 2 years ago
    while filtering single word in multiple sheets it does not shows filtered data....all datas are hided.pleace resolve this.
  • To post as a guest, your comment is unpublished.
    AHMAD KALBOUNEH · 2 years ago
    Dear,

    i want to filter more than one value, i used this xWs.Range("B1").AutoFilter 2, "=223AM", xlOr, "=113IR", xlOr, "=003IR" and it worked
    but when i increase the wanted values to >2 an error occurs.
    this command i use xWs.Range("B1").AutoFilter 2, "=223AM", xlOr, "=113IR", xlOr, "=003IR", xlOr, "=019IR", xlOr, "=311IR", xlOr, "=518ZA", xlOr, "=223AM", xlOr, "=592IR"


    thanks,
  • To post as a guest, your comment is unpublished.
    Guy · 2 years ago
    how do you apply this filter formula: to a range of sheets? i have a workbook that has data on the first 5 sheets, and the workbook has 200 sheets i only need the filter to be applied to sheet 6-200.
    Sub apply_autofilter_across_worksheets()
    'Updateby Extendoffice 20160623
    Dim xWs As Worksheet
    On Error Resume Next
    For Each xWs In Worksheets
    xWs.Range("A1").AutoFilter 1, "=KTE"
    Next
    End Sub
    • To post as a guest, your comment is unpublished.
      Cosmicbugaboo · 2 years ago
      Sub apply_autofilter_across_worksheets()

      Dim J As integer
      On Error Resume Next
      For J = 6 to Worksheets(worksheets.count)
      Thisworkbook.Sheets(J).Range("A1").Autofilter 1, "=KTE"
      Next
      End Sub