excel - Find where an Indexformula is pointing through VBA -


i'm working on vba script through range , convert index, vlookup, hlookup, offset etc formulas , re-write them static reference.

example

a1: a

a2: b

a3: c

=index(a1:a3, 2, 1) gives "b"

i to, through vba change formula to:

=a2

can done? how?

thank * 1000!

this small macro gets formula , first discards both "=index(" , ")" parts.

it splits apart 3 arguments. first argument treated range address. second , third arguments used offsets:

sub makereplacement()     dim rrow long, ccol long     dim dest range     s = activecell.formula     s2 = mid(s, 8)     ary = split(left(s2, len(s2) - 1), ",")     rrow = evaluate(ary(1)) - 1     ccol = evaluate(ary(2)) - 1     set dest = range(ary(0))(1).offset(rrow, ccol)     activecell.formula = "=" & dest.address(0, 0) end sub 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -