I would like a macro to autofilter all the columns and filter the values in the columns with header "bank charges" (will not always be in Col g as new columns are added from time to time)
I have tried to write code to do this, but it does not filter from row 5 and also get a run time error
"autofilter method of range class failed"
.Range("$A$5:$DZ" & LR).Autofilter Field:="Bank Charges", Criteria1:="<>0", Operator:=xlAnd, Criteria2:="<>" _
Sub Autofilter()
Dim LR As Long
Sheets("Data").Select
LR = Range("A" & Rows.Count).End(xlUp).Row
With Range("A5")
.Range(Selection, Selection.End(xlToRight)).Autofilter
.Range("$A$5:$DZ" & LR).Autofilter Field:="Bank Charges", Criteria1:="<>0", Operator:=xlAnd, Criteria2:="<>" _
End With
End Sub
I have also posted on https://www.mrexcel.com/forum/excel-...eo-blanks.html
Bookmarks