user_wqjmckei 发表于 2016-4-12 13:22:37

请高手赐教随机数ppt的问题

在ppt中怎样把随机数组用for each返回 label 或textbox中,并用动画滚动后,按按钮停止

Private Sub Command1_Click()
Dim S(6) As Integer
Dim I, j As Integer
Label1.Caption = ""
For I = 1 To UBound(S)
S(I) = Int((Rnd * 20) + 1)
For j = I - 1 To LBound(S) Step -1
If S(I) = S(j) Then
I = I - 1: Exit For
End If
Next j
Next I
For I = 1 To UBound(S)
Label1.Caption = Label1.Caption & " " & S(I)
Next I
End Sub
怎样让6个数进6个label 或textbox而不是6个进一个
还有谁能注册或显出下面随机数ppt的vba代码

tttcy 发表于 2016-4-12 15:30:40

Dim PauseTime, Start, Finish, TotalTimePrivate, a, b, c
Sub abc1()
    PauseTime = Int((1 * Rnd) + 1)    '
    Start = Timer    '
    Do While Timer < Start + PauseTime
      DoEvents    '
      a = Int((9 * Rnd) + 1)
      Txt2.Text = a
      b = Int((9 * Rnd) + 1)
      Txt3.Text = b
      c = Int((9 * Rnd) + 1)
      Txt1.Text = c
    Loop
End Sub
????????????

yelinxia 发表于 2016-4-12 16:54:41

谢谢jack0421,txt改textbox后成功,但时间短,想一直滚动按停止按钮停止
页: [1]
查看完整版本: 请高手赐教随机数ppt的问题