Results 1 to 8 of 8

Set all filters in Workbook to exclude current month

Threaded View

  1. #1
    Registered User
    Join Date
    04-06-2021
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    4

    Post Set all filters in Workbook to exclude current month

    Hi

    Looking for some help, I have a workbook with several tables across several worksheets that I want to be able to set all tables to exclude the current months data. I can obviously manually go through each worksheet but is tiresome as I have to regularly switch between 'to date' data and 'to last month' data

    I have a 'remove all filters' vba as below, but cannot work out how to modify to suit. Any help would be appreciated, thank you.

    Sub Remove_Filters()
        Dim xAF As AutoFilter
        Dim xFs As Filters
        Dim xLos As ListObjects
        Dim xLo As ListObject
        Dim xRg As Range
        Dim xWs As Worksheet
        Dim xIntC, xF1, xF2, xCount As Integer
        Application.ScreenUpdating = False
        On Error Resume Next
        For Each xWs In Application.Worksheets
            xWs.ShowAllData
            Set xLos = xWs.ListObjects
            xCount = xLos.Count
            For xF1 = 1 To xCount
             Set xLo = xLos.Item(xF1)
             Set xRg = xLo.Range
             xIntC = xRg.Columns.Count
             For xF2 = 1 To xIntC
                xLo.Range.AutoFilter Field:=xF2
             Next
            Next
        Next
        Application.ScreenUpdating = True
     
    End Sub
    Last edited by AliGW; 04-06-2021 at 05:36 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA refresh all pivot tables in the workbook then select the current month
    By mz_h in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-29-2020, 02:15 AM
  2. Filling down a table to current month/date with VBA up to current month
    By atombomb99 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-12-2019, 03:34 PM
  3. Replies: 1
    Last Post: 04-29-2016, 01:28 PM
  4. Cell referencing the current month same workbook but between two worksheets
    By QuintonMcCloud in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2015, 06:56 AM
  5. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  6. [SOLVED] Macro to copy data from source workbook to target, based on current month of the year
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-27-2014, 05:41 PM
  7. [SOLVED] Pick a cell containing current month actulas based what the current month is.
    By vanbasten007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-10-2014, 01:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1