list - Excel - VBA : Simplify this If statement comparing cell to words -


easy question here.
using in program :

if lcase(inp_rng.offset(1, 0).value) = "street" or lcase(inp_rng.offset(1, 0)) = "ave." score = score - 50 end if 

it not clean can find way put in 1 sentence only. programming way of writing this:

if lcase(inp_rng.offset(1,0).value = ("street", "ave.", "road", "...", etc.) 'do end if 

thanks in advance!

you can use select case statement instead:

i = lcase(inp_rng.offset(1,0).value select case     case "street", "ave.", "road"         'do     case else         'do end select 

alternatively can populate possible answers in array , search array match.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -