mysql - Excel Multiple Word Replacement in String -


goodday all!

i working on excel project , looking help. don't mind whether solved via formula or script.

to begin provide big picture. have whole bunch of sql queries call on various fields different locations. these field titles have changed. update sql queries new names of fields. such, going copy queries excel spreadsheet , lookup field names in string , replace them new field names table in sheet. problem there approximately 10 field names per query need replacing.

so thinking. essentially, if have string in cell a1 words: "we best". every word exists in string check if exists in table in sheet. if word exists in table, replace it. if not move onto next word. continue every word in cell.

any can provided appreciated. in advance!

consider:

sub fixit()     dim r range, range     dim s1 worksheet, s2 worksheet     set s1 = sheets("sheet1")     set s2 = sheets("sheet2")     set = s1.range("a:a").cells.specialcells(xlcelltypeconstants)     each r in         v = " " & r.value & " "         j = 1 10             oldv = " " & s2.cells(j, 1).text & " "             newv = " " & s2.cells(j, 2).text & " "             v = replace(v, oldv, newv)         next j         r.value = trim(v)     next r end sub 

in example replacement table in sheet2, cells a1 thru b10...............i pad "spaces" insure whole word replacement , avoid need split , join.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -