arguments not working with function
for a test, make sure that the cells pointed at contain just numbers, no
formula, and see if their vales get passed properly
"maweilian" wrote in message
...
I have added breakpoints and checked the values. The values are zero when
referencing cells of non-zero value. However, it does not exhibit this
behavior for all the arguments, which is puzzling to me. Most of the
arguments exhibiting this behavior contain values calculated by other VBA
macros. I do not know of this is the course of the problem. I don't see
why
it would be a problem.
"Patrick Molloy" wrote:
put a break point in the function
edit/enter the formula in the spreadsheet, then when the code halts at
the
breakpoint, check the values.
also have Option Explicit at the top of your module
"maweilian" wrote in message
...
Question from a Newbie Excel programmer,
I have a function that has arguments, for instance,
Private Function myfunction(arg1 as Double, arg2 as Double, etc...)
Dim anyvariable as Double
anyvariable = arg1 - arg2
....
End Function
What is happening in the function I am working on is that when I add a
breakpoint at the line "anyvariable = arg1 - arg2" and then inspect the
values of the arguments "arg1" and "arg2", I discover that they have
values
of zero. (obviously, "anyvariable" also acquires a value of zero after
the
execution of that line of code.) However, in the spreadsheet the
values
in
the cells referred to by the arguments are non-zero! Can anyone think
of
a
reason why the arguments are not acquiring the values of the cells to
which
they point?
The only thing I can think of is that the cells to which the arguments
point
do happen to contain values that are dependent on other VBA macros and
that
this could be creating a problem.
Please help,
Will
|