Help with Filter Macro

DaleRW

New Member
Joined
Nov 28, 2017
Messages
10
Hello,

I have a workbook that is used to bring in raw data for POS transactions from multiple locations. The macro used is to filter the data on a summary page as well as on individual worksheets for each location so on each worksheet only that location's transactions show and they are filtered so all Visa, MC, AMEX or Debit are together and each has a subtotal as well as a location grand total.

The macro we use to filter the information worked well at first but now when we hit the filter button it sorts it so only each location's transactions show on their worksheet but the worksheet is not sorted to have each type of transaction together and there are no subtotals, just a grand total for each location. If we hit the filter button a second time then everything gets sorted and filtered correctly.

If anyone can help with two things. First, how do I fix this so we only have to hit the filter button once and second, is there a way to combine all these lines into one that will filter all worksheets?

The macro we are using is:

Code:
Sub FilterSheet()
'
' FilterSheet Macro
'

'
    Sheets("(01)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(03)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(04)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(07)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(08)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(09)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(10)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(12)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(13)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(14)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(15)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(16)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(17)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(19)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(21)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(23)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(28)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(29)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(30)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(31)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(33)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(34)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(35)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(36)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(38)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(39)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(40)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(51)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(52)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(53)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(54)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(55)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(56)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(57)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(58)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(59)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(60)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("(62)").Select
    ActiveSheet.Range("$A$1:$A$3392").AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Summary").Select
    ActiveSheet.Range("$A$2:$A$118759").AutoFilter Field:=1, Criteria1:="<>"
    
End Sub
 
Last edited by a moderator:
I’m not really sure what’s going on at this stage ... Could you upload a copy of the file with dummy data in one of the file sharing websites (Dropbox for example) & share the link here so we could understand what’s happing ?
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top