1 / 5

Call by Value

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?????.

Download Presentation

Call by Value

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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!

  2. 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

  3. 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”

  4. 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

  5. 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

More Related