excel - Replace Numerical Reference of a formula VBA? -
for = 1 5     changeto = cstr(sheet15.cells(1, i).formula)     newindustry = getfirstword(worksheets("industry insert template").range("c1"))     'grab index position of comma , exclamation mark     intchangeto = instr(changeto, ",")     finalchangeto = instr(changeto, "!")     'extract worksheet substring     finalindustry = mid(changeto, intchangeto + 1, finalchangeto - intchangeto - 1)      if finalindustry <> "'multiples & eps'" , finalindustry <> "technicals"         finalformula = replace(changeto, finalindustry, newindustry)         cells(1, i).formula = finalformula     end if next currently macro adjust worksheet name.
 want adjust numerical reference.
for example:
=vlookup($b1,industrials!$ca$41:$gg$41,c$8) i want able change cells 41 in vlookup reflect correct row. 
how go through cells , change formula reflect this?
use replace:
example :
cells (1, i).formula = replace(cells (1, i).formula, oldrow, newrow) if value of i related row number, can use in place of old row etc.
Comments
Post a Comment