Friday 15 August 2014

excel - VBA extract numerator and denominator with named values -



excel - VBA extract numerator and denominator with named values -

i'm trying extract numerator , denominator of range of cells using vba.

so example, in cell a1 formula is: =nv2/nv3. nv2 , nv3 named values , illustration nv2 = 3 , nv3=6. in text, result of formula in a1 0.5.

what approach retrieve nv2 , nv3? need somehow create reference formula believe.

many help.

select cells wish examine , run:

sub marine() dim r range each r in selection v = r.formula if r.hasformula , instr(v, "/") > 0 ary = split(mid(v, 2), "/") msg = r.address & vbcrlf & v & vbcrlf & ary(0) & vbcrlf & ary(1) msgbox msg end if next r end sub

excel vba excel-vba

No comments:

Post a Comment