ByVal or ByRef - As Variant


Integers

When you declare a variable with an Integer data type it can be passed in using either ByVal or ByRef.
When you declare a variable with a Variant data it can be passed in using either ByVal or ByRef.



Arrays

There is a difference between declaring a variable with a Variant data type as opposed to an Array data type.
When you declare a variable with an Array data type it can only be passed in using ByRef.
When you declare a variable with a Variant data type it can be passed in using either ByVal or ByRef.


Collections


Classes

When you declare a variable with a Class data type it can be passed in using either ByVal or ByRef.
When you declare a variable with a Variant data type it can only be passed in using either ByVal.

When you declare a variable with a Variant data type it can only be passed in using ByVal.


User Defined Types



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext