excel - InStr(1, cell.Value, "-") doesn't seem to be working with Not -


i have conditional doesn't seem work.

if not instr(1, cell.value, "-")     'do else     'do else end if 

where cell.value either numbers in spreadsheet dash: "6621-123", or without dash: "555321"

the first if let's both through , else ignored. ideas why isn't working?

instr returns 0 on no match (not -1 vba string indexes 1 based) , not 0 true (-1); other possible values > 0 can returned.

if instr(1, cell.value, "-") = 0     '// not present else     '// present   

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -