Excel VBA - Batch find and replace of formula -
trying determine correct way complete batch find , replace of formulas, i.e.
worksheet 1
has columns a
, b
. a
find column , b
replace column.
worksheet 2
has lots of rows , columns lots of formulas. worksheet want find , replace occur on.
i want excel in formulas on worksheet 2
, not values.
the values in worksheet 1
1 not whole contents of formulas in worksheet 2
, parts (i think need use xlpart
) somewhere.
anyone know how write script through worksheet 2
formulas listed values in worksheet 1
, column a
, , replace value on same row of worksheet 1
in column b
?
anyone know how write script
well easiest way through vba editor. if intend target whole of sheet 2, you're going need make use of usedrange property.
after that, it's not difficult write formula loops through range (that obtained using usedrange property).
in loop, you're going need its' formula, use replace function replace instances of search string replacement string. if want, can loop here in worksheet 1 replacement step multiple pairs.
once you've done should handle errors (unless you're absolutely replacements result in formula), because excel argue if try put in bad formula.
without effort, can done in 30 lines of code (or less if you're tricky enough).
Comments
Post a Comment