EXCEL VBA获取幸运数字号码

EXCELVBA获取幸运数字号码

以下就是VBA幸运号码产生的程序,复制粘贴到VBA代码框即可运行

Option Base 1
Sub 幸运号码()
    Dim n As Integer, i As Integer, j As Integer
    Dim l() As Integer
    n = Application.InputBox("请输入需要产生幸运号码的数量:", "幸运号码", , , , , , 2)
    ReDim l(n, 7) As Integer
    For i = 1 To n
        For j = 1 To 7
            Randomize
            l(i, j) = Int(10 * Rnd)
        Next
    Next
    For i = 1 To n
        For j = 1 To 7
            Debug.Print l(i, j);
        Next
        Debug.Print
    Next
End Sub

你可能感兴趣的:(excelVBA专栏,excel,开发语言)