VBA - Filter to show blanks

Foz1980

Board Regular
Joined
May 6, 2015
Messages
128
Hi all,

Please bear with me as my VBA skills are fairly limited (compared to you lot).

I have some code and that I want to do is a filter to show data where column T is blank.

I've tried;

Code:
ActiveSheet.Range("$A$1:$T$28").AutoFilter Field:=14, Criteria1:="="

And this does appear to work, but I dont know if this is the most robust way.

Does anyone have a better suggestion or will this always work fine regardless?

Cheers

Chris
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
That is not filtering on col T it's filtering on col N
I your data is likely to go beyond row 28 try
Code:
ActiveSheet.UsedRange.AutoFilter Field:=20, Criteria1:="="
 
Upvote 0
That is the way to filter for blanks in the 14th column of the range, yes. :)
 
Upvote 0
That is not filtering on col T it's filtering on col N
I your data is likely to go beyond row 28 try
Code:
ActiveSheet.UsedRange.AutoFilter Field:=20, Criteria1:="="

Yes sorry, I did actually mean N not T. But your code has worked perfectly (but using field:=14).

Thank-you.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,204
Messages
6,123,630
Members
449,109
Latest member
Sebas8956

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