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

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -