excel - UDF to make a kind of Substitute Array-Function -


i'm trying make function not substitute 1 text another, substitute set of values range lateral set of values.

i have this:

public function substituterange(rangewithtext range, twocolumnmatrix range) string dim text string text = "/" & rangewithtext.value & "/" 'as example st this: "/" & "1/2/3/4/5/6/7/8" & "/" = "/1/2/3/4/5/6/7/8/" dim searchforrange range set searchforrange = twocolumnmatrix.columns(1) 'let "a1:a4" /2/ /3/ /4/ /5/ in each cell     dim replacewithrange range set replacewithrange = twocolumnmatrix.columns(2) 'let "b1:b4" /9/ /10/ /11/ /12/ in each cell dim integer substituterange = text = 1 searchforrange.rows.count '4 rows substituterange = application.worksheetfunction.substitute(substituterange, _ searchforrange.item(i), replacewithrange.item(i)) next end function 

but return "#value!" error, can me ? expected example "/1/9/10/11/12/6/7/8/" didn't it. thank in advance.

function multireplace(v, rng)     dim rw range, rv     rv = "/" & v & "/"     each rw in rng.rows         rv = replace(rv, rw.cells(1).value, rw.cells(2).value)     next rw     multireplace = rv end function 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -