#value! error while using Range object in VBA/Excel -
i trying write first vba macro excel 2010. needs long calculations 200,000 rows , needs populate 2 adjacent cells on active row. following vba function crude first attempt accomplish above. problem while executing macro, #value! error. if remove "cells" , .value lines, works fine , populates activecell appropriate value. doing wrong?
appreciate much.
public function somecalculation() integer      dim r range     dim nrow, ncol integer      nrow = activecell.row     ncol = activecell.column      r = cells(nrow, ncol + 1)     r.value = nrow * 100 + ncol      somecalculation = nrow * 1000 + ncol  end function      
"cells" object, must use 'set' object assign it.
but it's not possible modify cells 1 function.
edit : remove wrong code
    set r = cells(nrow, ncol + 1)      
Comments
Post a Comment