vba - Return a variable by a function and store it a new variable -
i want create 2 functions: 1 should "produce" number , other should perform function parameter number.
i got following code
sub get_number() dim x integer x = 3 return x end sub
but cant return numeric value because throws compile error. thoughts on how can function return x value , store in new variable (fe y()
you need use function, not sub, , assign return value name of function:
function get_number() dim x integer x = 3 get_number = x end function
then use:
y = get_number
in other code.
Comments
Post a Comment