View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
maweilian maweilian is offline
external usenet poster
 
Posts: 11
Default arguments not working with function

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