help with filtering when recording

jordanburch

Board Regular
Joined
Jun 10, 2016
Messages
217
Office Version
  1. 2016
Hey guys,

I have the following

ActiveSheet.Range("$A$1:$BS$5072").AutoFilter Field:=71, Criteria1:="<>#N/A", _
Operator:=xlOr, Criteria2:="<>"


basically I want it to filter out na and blanks and display anything else. It doesnt seem to be working, but the code isnt giving me an error. Thoughts?

Jordan
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
50,883
Office Version
  1. 365
Platform
  1. Windows
In what way isn't it working?
Also are the #N/A formula errors?
 

jordanburch

Board Regular
Joined
Jun 10, 2016
Messages
217
Office Version
  1. 2016
In what way isn't it working?
Also are the #N/A formula errors?
its pulling through all data. I need to to pull through the matches with the rows only, but that could change from time to time so I want to simply exclude the na and the blanks and copy paste. I think I need an array because I want them both filtered I change it to such

ActiveSheet.Range("$A$1:$BS$5072").AutoFilter Field:=71, Criteria1:=Array( _
"<>#N/A", "<>"), Operator:=xlFilterValues

will that fix my issue?
 

jordanburch

Board Regular
Joined
Jun 10, 2016
Messages
217
Office Version
  1. 2016
its pulling through all data. I need to to pull through the matches with the rows only, but that could change from time to time so I want to simply exclude the na and the blanks and copy paste. I think I need an array because I want them both filtered I change it to such

ActiveSheet.Range("$A$1:$BS$5072").AutoFilter Field:=71, Criteria1:=Array( _
"<>#N/A", "<>"), Operator:=xlFilterValues

will that fix my issue?
so i tested it out and it errors out and does not work
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
50,883
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

You didn't answer this part of my question
Also are the #N/A formula errors?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
50,883
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

In that case just change the xlOr in your original code to xlAnd
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
50,883
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,785
Messages
5,574,262
Members
412,581
Latest member
Rami100
Top