vba - Sum a Range and Format the Sum Error -


i have bit of code doesn't run:

dim conctotal double  conctotal = workbooks("mw_vs_rf.xls").sheets(wbktwo).format$(sum(range("c4:c14")), "0.0000") 

where wbktwo specific tab in xls sheet. trying sum range in sheet , assign conctotal. everytime run error message saying "compile error: sub or function not defined" , highlights "sum" in code above. not see issue code or how written, on why getting error appreciated.

thanks

use application.worksheetfuntion.sum() instead of sum()

is trying?

sub sample()     dim conctotal double     dim wb workbook     dim ws worksheet     dim rng range      set wb = workbooks("mw_vs_rf.xls")     set ws = wb.sheets(1) '~~> testing purpose, replaced `wbktwo`     set rng = ws.range("c4:c14")      conctotal = format(application.worksheetfunction.sum(rng), "0.0000")      debug.print conctotal end sub 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -