Public Sub Test() Dim X As Integer = 1 Dim Y As Integer = 2 Swap(X, Y) MsgBox ("X=" & X & ", Y=" & Y) End Sub Public Sub Swap(ByRef value1 As Integer, ByRef value2 As Integer) Dim temp As Integer temp = value1 value1 = value2 value2 = temp End Sub