Skip to content

Instantly share code, notes, and snippets.

@ateneva
Last active February 17, 2018 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/5df3215389701423b2c47cbd73fb8afe to your computer and use it in GitHub Desktop.
Save ateneva/5df3215389701423b2c47cbd73fb8afe to your computer and use it in GitHub Desktop.
Option Explicit
Sub FilterAllTablesInActiveSheet()
Dim Wks As Worksheet
Dim T As ListObject
Dim i As Integer
Dim bU As String
bU = ActiveSheet.Range("C6").Value
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each Wks In ThisWorkbook.Worksheets
If Wks.Visible = True Then Wks.Activate
If ActiveSheet.ListObjects.Count > 0 Then
For Each T In ActiveSheet.ListObjects
If bU = "All" Then
T.Range.AutoFilter Field:=1
Else
T.Range.AutoFilter Field:=1, Criteria1:=bU
End If
Next T
End If
Next Wks
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment