Hi,
Can someone explain why a public variable is not retaining it's value when exiting a subroutine.
I want to search through an array and if a condition is hit then the subroutine exited (thereby holding the index value of a variable named MarkerNo)
The variable is dimmed in a separate module as public.
Code:Public Sub FindMarker() For MarkerNo As Integer = 0 To UBound(Markers) If A(MarkerNo) = B Then Exit Sub Next MarkerNo = -1 'Return -1 if not found End Sub