Excel VBA function - add "+" to every word in a cell with exception -


i found topic here same question. @kazimierzjawor posted solution (sub). want turn solution function work single value passed in:

function addplus(word string) string  dim tmpwords variant  dim skipwords variant  skipwords = array("в", "от", "под", "над", "за", "перед")  dim integer, j integer  dim final string, boexclude boolean  tmpwords = split(word.value, " ")  = 0 ubound(tmpwords)   j = 0 ubound(skipwords)    if ucase(skipwords(j)) = ucase(tmpwords(i))     boexclude = true    exit    end if   next j   if boexclude = false    final = final & "+" & tmpwords(i) & " "   else    final = final & tmpwords(i) & " "   end if   boexclude = false  next word = left(final, len(final) - 1) final = "" end function 

however function throws error "invalid qualifier" in line

tmpwords = split(word.value, " ") 

i know has easy, i'm new vba , haven't figured out how fix this. maybe here can me?

should be:

function addplus(word string) string dim tmpwords variant  dim skipwords variant  skipwords = array("в", "от", "под", "над", "за", "перед")  dim integer, j integer  dim final string, boexclude boolean  tmpwords = split(word, " ")  final = ""  = 0 ubound(tmpwords)   j = 0 ubound(skipwords)    if ucase(skipwords(j)) = ucase(tmpwords(i))     boexclude = true    exit    end if   next j   if boexclude = false    final = final & "+" & tmpwords(i) & " "   else    final = final & tmpwords(i) & " "   end if   boexclude = false  next addplus = left(final, len(final) - 1)     end function 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -