ByVal or ByRef - Integers

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


ByRef

Passing an Integer into a subroutine using ByRef allows the original variable to be changed.


ByVal

Passing an Integer into a subroutine using ByVal prevents the original variable from being changed.
In this example we are going to create a new integer data type and then pass this integer into two subroutines.
The first subroutine will have the integer passed ByVal and the second one will be passed by ByRef.



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