vba - Or loop doing the opposite of what I want -


i'm trying or loop work in vba instead of avoiding cells have letters in them, it's making whole array "-". if put in numbers or words replaces whole array dash.

private sub commandbutton1_click()  dim l double, c double  l = 14 18     c = 10 12       if cells(l, c).value <> "w" or _     cells(l, c).value <> "w" or _     cells(l, c).value <> "x" or _     cells(l, c).value <> "x" or _     cells(l, c).value <> "y" or _     cells(l, c).value <> "y" or _     cells(l, c).value <> "z" or _     cells(l, c).value <> "z"     cells(l, c).value = "-"     end if      next c next l  end sub 

you need , conditions together.

if cells(l, c).value <> "w" , _     cells(l, c).value <> "w" , _     cells(l, c).value <> "x" , _     cells(l, c).value <> "x" , _     cells(l, c).value <> "y" , _     cells(l, c).value <> "y" , _     cells(l, c).value <> "z" , _     cells(l, c).value <> "z" 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -