VBA to show only certain value after filter

Nancy123

New Member
Joined
Jan 15, 2021
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I have a question. So I am trying to make a VBA with filters. If the result met the condition, it shows YES. If the result doesn't meet the condition, it shows NO.
The next step that I'm confuse is, if all the results are showing as NO, then I want it to Exit the Sub. But if there's any YES, I want it to filter all the result that was showing YES.
Could you please help?
Also, here's the VBA code, I've made only until the filter mode.
VBA Code:
ThisWorkbook.Sheets("WHT ID").Range("$AW$2").FormulaR1C1 = "=IF(OR(R[23]C[-28]=""0088220300"",R[23]C[-28]=""0088320100"",R[23]C[-28]=""0088110600""),""YES"",""NO"")"
ThisWorkbook.Sheets("WHT ID").Range("$AW$2").AutoFill Destination:=Range("$AW$2:$AW" & Range("$B" & Rows.Count).End(xlUp).Row)
ThisWorkbook.Sheets("WHT ID").Range("A:AW").EntireColumn.AutoFit
ThisWorkbook.Sheets("WHT ID").Range("A1:AW1").autofilter
Thank you!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,216,743
Messages
6,132,466
Members
449,729
Latest member
davelevnt

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