VBA to apply advance filter to find blank cells

kgkev

Well-known Member
Joined
Jun 24, 2008
Messages
1,291
Office Version
  1. 365
Platform
  1. Windows
this is my current code.

Code:
NR.Range("A1").Value = CS.Range("D5").Value   '(REQUIRED)
NR.Range("A2").Value = "<" & Format(CDate(Now()), "mm/dd/yyyy")
NR.Range("A3").Value = "<" & Format(CDate(Now()), "mm/dd/yyyy")


NR.Range("B1").Value = CS.Range("O5").Value   '(DUE)
NR.Range("B2").Value = "<" & Format(CDate(Now()), "mm/dd/yyyy")
NR.Range("B3").Value = [COLOR=#ff0000]BLANK[/COLOR]




'APPLY FILTER
CS.Range("A5:Z10000").AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=NR.Range("A1:B2"), _
    CopyToRange:=NR.Range("A12"), _
    Unique:=False

The Due column normally contains a date, i succesfully filter this date when it is before today.
However I cannot find the correct syntax to filter this column when blank.


in english...


('Required' = Before today AND 'Due' = Before today) OR
('Required' = Before today AND 'Due' = BLANK)

any help is appreciated
 

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.
Have you tried using equal sign "=" (without quotes in the cell but off course with quotes in vba)

Code:
NR.Range("B3").Value = "="
 
Upvote 0
Thanks, But it didn't work.

Maybe because column O contains a formula... (sorry for not mentioning it before :) )


=IFERROR(IF(VLOOKUP(A6&"/"&B6,Comments!A:C,3,0)<10,"",VLOOKUP(A6&"/"&B6,Comments!A:C,3,0)),"")

so I am looking for the ""
 
Upvote 0
In that case try ="" in the cell or in vba:
Code:
NR.Range("B3").Value =  "="""""
 
Upvote 0
Solution

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

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