auto filter when equal to x

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
440
Office Version
  1. 2016
hey guys im having an error when it hits this line of code

ActiveSheet.Range("$A$1:$AF$65171").AutoFilter Field:=32, Criteria1:="=X"

it used to be

ActiveSheet.Range("$A$1:$AF$65171").AutoFilter Field:=32, Criteria1:="<>"

basically I only want it to filter for x in that column. Can anyone help?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
What error do you get, as there's nothing wrong with that line of code.
 
Upvote 0
Have you changed the data at all, or protected the sheet?
 
Upvote 0
Have you changed the data at all, or protected the sheet?
So its a concatenate formula that reads off of other formulas before it if this then X type of formulas. Im not sure what you mean about changing the data. I imports 5 files total and add formuals to the end to get x and copy paste that x in that column to a new table as this is the only data i need. It is not protected as far as I know I have not done that.
 
Upvote 0
If you change the criteria back to what it was originally, do you still get the error?
 
Upvote 0
Hi Fluff

What I did is make the formula into a literal X and it did not change anything. I also tried

ActiveSheet.AutofilterMode = False
Range("AF1:AF").AutoFilter Field:=1, Criteria1:="X"

that didnt work either. Basically I want the af column to filter for X and the range could be shorter or longer depending on the month, IE AF50000 or af 60000.

hopefully that makes sense.

Jordan
 
Upvote 0
Have you converted your data into a structured table?
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,173
Latest member
Kon123

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