Dim i As Integer
Dim min As Integer
Dim max As Integer
Dim N As Integer
N = CInt(InputBox("Введите N"))
Dim A(N) As Integer
min = 0
max = 0
For i = 0 To N
If A(i) < A(min) Then min = i
If A(i) < A(max) Then max = i
Next
i = A(min)
A(min) = A(max)
A(max) = i