Do Search Criteria

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Hi, sorry if title wrong, dont really know what to call this

Have the following code which excludes any rows where the critera given is met.

Do Until Range("A" & R).Value = ""
If Sheets("checkSmart").Range(QRiskRule1 &R).Value = "Annual Review" OrSheets("checkSmart").Range(QAdvType & R).Value ="Other" Or Sheets("checkSmart").Range(QQueuestatus &R).Value = "Adviser Contact Complete" Or Sheets("checkSmart").Range(QAdvType &R).Value = "SImon" Or Sheets("checkSmart").Range(QAdvType& R).Value = "Jane" OrSheets("checkSmart").Range(QAdvType & R).Value = "Pete"Or Sheets("checkSmart").Range(QAdvType & R).Value = "Jackie"Or Sheets("checkSmart").Range(QAdvType & R).Value = "Ian"Or Sheets("checkSmart").Range(QAdvType & R).Value = "Andrew"Or Sheets("checkSmart").Range(QSubmissionDate & R) <= dateRngThen

Else

Curently no row at status "advise contact complete" pulls through


However i need to change part so it considers two columns together, this is what i am trying

Sheets("checkSmart").Range(QQueuestatus& R).Value = "Adviser Contact Complete" &Sheets("checkSmart").Range(QFailureDescription & R).Value ="Pass"

I have tried, "&" as shown,putting it in Brackets, taking the 2nd Sheets "checkSmart" out.

but thing works.

With the above solution it pulls through all rows with "adviser contact complete", when i only want those which are at Status "adviser contact complete" with a failure description that is not "pass"

Any ideas?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I think you should split the If statement over multiple lines like this:

Code:
Do Until Range("A" & R).Value = ""
    If Sheets("checkSmart").Range(QRiskRule1 & R).Value = "Annual Review" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Other" _
    Or (Sheets("checkSmart").Range(QQueuestatus & R).Value = "Adviser Contact Complete" And Sheets("checkSmart").Range(QFailureDescription & R).Value = "Pass") _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Simon" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Jane" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Pete" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Jackie" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Ian" _
    Or Sheets("checkSmart").Range(QAdvType & R).Value = "Andrew" _
    Or Sheets("checkSmart").Range(QSubmissionDate & R) <= dateRng Then
    Else

WBD
 
Upvote 0
thanks , the only thing i had not tried was "and" rather than "&"

works prefectly now , thanks
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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