Posts

Showing posts with the label By Val and By Ref in VBA

Passing parameters - VBA

Image
Hello Readers, Welcome to Coding by Learning !!! 😀  Most of the programming languages has the concept of passing parameters to functions in different ways. Python, C, C++ and Java programming languages have the concept in the name of Call by value and Call by reference. In VBA , It is arrived using keywords ByVal and ByRef. Difference between ByVal and ByRef Now lets see the concepts with an example Here in the example, I have written a sub procedure for calculating sum of 2 numbers. I have created 2 functions "add2Numbers_byval" and "add2Numbers_byref" for differentiating the concepts. Output as follows :- Look at the output. The value of iNum2 is same using ByVal and It is modified using By Ref. Happy learning & Happy Coding !!! Comment and share this post to your friends and colleagues 😀

Popular posts from this blog

Python Game Tutorial - The Smiley Crush Game

VBA Interview Questions - Part 2 - Variables and Data types

VLOOKUP – Excel Formula