Dim sum As Integer Dim i As Integer Dim a As Integer Private Sub Command1_Click() sum = 0 For i = 1 To 10 Randomize a = Int(Rnd * 1000) sum = sum + a MsgBox "10个随机数和为:" & sum Next End Sub