楼主看看这个:
Private Sub Command1_Click()
Dim aNum(9) As Long, V As Long
Dim nMax As Long, nMin As Long
Dim vAvg As Double, i As Long
Randomize
nMax = 0: nMin = 100'初始化设置
For i = 0 To 9'产生10个数据
V = 10 + 89 * Rnd()'10到99
aNum(i) = V
If (V > nMax) Then nMax = V
If (V < nMin) Then nMin = V
Next
'输出到窗口,同时求数据之和
Me.Cls: V = 0
Print "这10个数是:"
For i = 0 To 9
Print aNum(i);
V = V + aNum(i)
Next
Print vbLf "最大数是:" nMax
Print "最小数是:" nMin
V = V - nMax - nMin'去掉最大、最小值
' 如果要按10个数算平均值,把下面改为 V/10
Print "平均值为:"; V / 8
End Su