This is one of most asked questions in VBA interviews. In this article we will learn what’s the difference between ByVal and ByRef arguments in excel VBA.Definitions:ByRef argument: It is the literal short form of by reference. When an argument is passed...
We all know the difference between passing value types byval and byref, if the variable is passed byval any change to the variable value in the called function is not reflected back in the callee because a copy of the variable is passed, whereas passing it byref means that the changes ...
So what is the difference between passing byref v/s passing byval? Lets take a look at the slightly modified version of above code: static void Main() { Hashtable hst = new Hashtable(3); hst.Add(1,1); PassHashTableByVal(hst); //by default .net parameters are passed by val Consol...