下面是一个将数组最后一个值移到数组的最前项,其他项顺序往后移的样例程序。
Sub test()
Dim arr(6) As Integer arr(0) = 1 arr(1) = 8 arr(2) = 23 arr(3) = 89 arr(4) = 120 arr(5) = 218 arr(6) = 256 Dim i As Integer Dim temp As Integer For i = 0 To 6 temp = arr(6) arr(6) = arr(i) arr(i) = temp Next End Sub