Modify and If statement

Shadkng

Active Member
Joined
Oct 11, 2018
Messages
365
Hi, can someone revise my code below to also include NE to "yes" (lower case). Right now it only works with yes in upper case. Thanks

VBA Code:
On Error Resume Next
If Evaluate("=VLOOKUP(FINALORDER!D4,DEALERLIST!$A$3:$O$1200,15,FALSE)") <> "YES" Then
Exit Sub
End If
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Maybe
VBA Code:
On Error Resume Next
If Ucase(Evaluate("=VLOOKUP(FINALORDER!D4,DEALERLIST!$A$3:$O$1200,15,FALSE)") )<> "YES" Then
Exit Sub
End If
 
Upvote 0
Solution
Well, since your Evaluate function seems to be returning a string, you should just be able to use the LCase function:
VBA Code:
On Error Resume Next
If LCase(Evaluate("=VLOOKUP(FINALORDER!D4,DEALERLIST!$A$3:$O$1200,15,FALSE)")) <> "yes" Then
     Exit Sub
End If

Or, if you want to modify what you already have, you can use the UCase function instead:
VBA Code:
On Error Resume Next
If UCase(Evaluate("=VLOOKUP(FINALORDER!D4,DEALERLIST!$A$3:$O$1200,15,FALSE)")) <> "YES" Then
     Exit Sub
End If
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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