VBA Advanced Filter, return all columns if value matches in 1 column

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the code below, which only returns values for first column, not all columns.

Sheet: wTransactions
Table: tbl_Transactions in range A1:L40981
Filter range: AA1:AL2, where AA1:AL1 = A1:L1 (headers match those of tbl_Transactions)
Filter criteria: AC2, a value that exists in C1:C40981, AA2:AB2, AD2:AL2 are empty

Can anyone suggest correction to code below so it returns values across AA4:ALx (where x is count of filtered records + 3), it only returns filtered values only in AA4 and down, not AA4:AL4 and down:
Code:
Sub Macro3()
    
    With wTransactions
        With .[Temp_Output]
            .Offset(1).Resize(, 12).Value = ""
            .Offset(1, 2).Value = UCase("Bank Charges") '[Account_User]
        End With
        .[tbl_Transactions[#All]].AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=.[AA1:AL2], CopyToRange:=.[AA4]
    End With
            
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Do you clear the copytorange, before running the filter?
 
Upvote 0
Hey Fluff, yes I hadn't cleared the range out, figured it out earlier today but forgot to update back here. Thanks for taking a look :)
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,226
Members
448,878
Latest member
Da9l87

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