VBA autofilter error

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Below, my filter is not applied...it giving me an error..

Run time error 1004
AutoFilter method of Range class failed

Pls suggest..

Code:
    Range("A5").Select
    ActiveWindow.FreezePanes = False
    
    Range("A4").Select
    Selection.AutoFilter
    
    Range("AF4").Select
    ActiveSheet.Range(Cells(4, 32), Cells(LstRw5, 32)).AutoFilter Field:=32, Criteria1:=nm
 
Last edited by a moderator:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Re: Need help on filter

Code:
Range("AF4", Cells(Rows.Count, "AF")).AutoFilter Field:=[U]1[/U], Criteria1:=nm

Field is referenced to the first column of the autofilter range.
 
Last edited:
Upvote 0
Re: Need help on filter

Code:
Range("AF4", Cells(Rows.Count, "AF")).AutoFilter Field:=[U]1[/U], Criteria1:=nm

Field is referenced to the first column of the autofilter range.

Hey Hi, SHG...Sorry for pop-upd again...
but the filter is not working on Col AF i.e. 32 number Column..
I want to filter on AF values..

Pls suggest..
 
Upvote 0
It works in Texas, exactly as written. What column is it filtering for you?
 
Last edited:
Upvote 0
Dear All,

I got the solution, just sharing with you all..
Worksheets("worksheetName").Range("AF4").AutoFilter field:=32, Criteria1:=nm
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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