Would someone please assist me (no baseball bats at this stage) in understanding the following code on merging arrays
Function Merge(ByVal arr1 As Variant, ByVal arr2 As Variant) As Variant
Dim tmpArr As Variant, upper1 As Long, upper2 As Long
Dim higherUpper As Long, i As Long, newIndex As Long
upper1 = UBound(arr1) + 1 : upper2 = UBound(arr2) + 1
higherUpper = IIf(upper1 >= upper2, upper1, upper2)
ReDim tmpArr(upper1 + upper2 - 1)
For i = 0 To higherUpper
If i < upper1 Then
tmpArr(newIndex) = arr1(i)
newIndex = newIndex + 1
End If
If i < upper2 Then
tmpArr(newIndex) = arr2(i)
newIndex = newIndex + 1
End If
Next i
Merge = tmpArr
End Function