I try to explain how to pass values to a custom function. It takes a while to understand but once you got it you can do a lot of things with it. Follow along by writing your own macro at the same time as the video. Open your Locals Windows in the VBA editor and watch the values get assigned and created as you move from Sub to the Function, and back.
A way of passing the value of an argument to a procedure instead of
passing the address. This allows the procedure to access a copy of the variable.
As a result, the variable's actual value can't be changed by the procedure to
which it is passed.
A way of passing the address of an argument to a procedure instead of
passing the value. This allows the procedure to access the actual variable. As a
result, the variable's actual value can be changed by the procedure to which it
is passed. Unless otherwise specified, arguments are passed by reference.