文件名称:VBA典型试题-及答案.doc
文件大小:64KB
文件格式:DOC
更新时间:2023-07-29 17:09:13
VBA典型试题 vba 典型试题
1、 编写程序,随机生成20个两位整数,并统计出其中小于等于60、大于60小于等于80及大于80的数据以及相应个数,结果打印输出到窗体。 Private Sub Form_Click() For i = 1 To 20 a = Fix(Rnd() * 91 + 10) If a <= 60 Then x = x & a & " " b = b + 1 End If If a > 60 And b <= 80 Then y = y & a & " " c = c + 1 End If If a > 80 Then z = z & a & " " d = d + 1 End If Next i Print "小于等于60的个数:" & b & "个," & x Print "大于60小于等于80的个数:" & c & "个," & y Print "大于80的个数:" & d & "个," & z End Sub