70 likes | 361 Views
Call by Value. =PVNRT(“R”,C11,C13,C13,C14). Function PVNRT(SolveFor, v1,v2,v3,v4). ……. PVNRT = v1*v2/ (v3*v4) End Function. But what happen if you put a statement like: v4 = v3/v2 in your code. Does Cell C14 change?????.
E N D
Call by Value =PVNRT(“R”,C11,C13,C13,C14) Function PVNRT(SolveFor, v1,v2,v3,v4) …….. PVNRT = v1*v2/ (v3*v4) End Function But what happen if you put a statement like: v4 = v3/v2 in your code. Does Cell C14 change????? By default, argument are “Call by Value, which means the values are placed in the argument list and not replaced upon return -- The arrows are one way signs!
Scope and Lifetime Scope:What functions / subs can get the value of a variable. Lifetime:How long does a variable have a value? Will discuss this briefly, but will not dwell on it
Module 1 Points to Ponder: Declarations Dim x as single Dim y as single Function One (a,b,c) ….. x = a*b y=a/c One = x/y End Function Sub Two (a, b, c) Dim p as single Dim q as single x=2*y+a/c+b ……. End Sub x & y are declared in the Declarations section, thus they are available to all subs/functions in Module 1. p & q are declared only in Sub Two, so their values are only available in Sub Two. When Sub Two is finished, the values of p & q “disappear” When Module 1 is exited, the values of x & y “disappear”
Module1 Module2 Declarations Dim x as single Dim y as single Function One (a,b,c) ….. One = x/y End Function Sub Two (a, b, c) Dim p as single Dim q as single ……. End Sub Declarations Dim x as single Dim y as single Function Onea (a,b,c) ….. Onea = y/x End Function Sub Twoa (a, b, c) ……. End Sub Module1 does not “know” anything about Module2 and vice versa
Buttons / Forms / And other Cool Stuff Used to “Dress Up” an application Used to interact with the user Available from the IDE and from the Excel toolbar Will look at only a few items