vba - Simple Excel VB Cell value change - Error #1004: Application-defind or object-defined error -
i've been trying fix error hours , can't seem see doing wrong here.
my macro follows:
function testvaluechange(cell range) on error goto errorhandler dim testvalue string testvalue = range(cell.address) msgbox testvalue range("q2") = "new value" exit function errorhandler: msgbox "error #" & err & " : " & error(err) end function
i able retrieve "testvalue" correctly , displayed on msgbox. however, when try set new value cell "q2", error "error #1004: application-defined or object-defined error."
there several entries error on web none of them in situation when i'm trying set string value empty cell!
the cell "q2" empty, i've chosen cell because not merged, nor referenced on function or anything.
thanks in advance help!
you cannot assign values cells, or change them in manner, when calling function (or call chain has started function). sub work. exception function value can assigned cell containing function reference
Comments
Post a Comment