02
Locate Common and click on the right, then locate the check box "Show developer tab on ribbon" and press OK.
03
Click the development tool to bring up the development control.
04
Use the transferred development control, 2 labels, 2 text boxes and the 1 button. Combined with Excel knowledge, make the following interface.
05
Macros can be found in views or development tools. Then open macro editing.
06
Add VBA code:
Option base 1
Size t 1 is long' range 1
Set t2 to long range 2.
Lottery number in integer form
Dim num is an integer.
Sub auto_open()
Apply. OnKey“{ ENTER }”,“cj”
Apply. OnKey "~ "," cj "
End joint
Common function tj(lb) in integer form
Mark k as an integer
k = 2
do
Set myR = number of sheets (points). Cell (k, 1)
If trimmed (Malaysian dollars. Value) = "" Then' has an empty record.
Exit Do
If ... it will be over.
k = k + 1
Loop until an error occurs.
tj = k - 1
End function
Common function csf ()
num = tj("temp ")
With worksheet ("temporary")
t 1 =。 Cell (number, 3). value
t2 =。 Cell (number, 4). value
End with ...
Worksheet ("Lottery Plan"). Text box 1. Text = t 1。
Worksheet ("Lottery Plan"). Text box 2. Text = t2。
End function
Common function cj ()
num = tj("temp ")
Call csf
Call cjsz
End function
Common function cjsz ()
Dimension r( 10)
For i = 1 to 10.
xh = False
do
d = Int((T2-t 1+ 1)* Rnd+t 1)
j = 0
do
j = j + 1
If r(j) = d, then
xh = False
Exit Do
other
xh = True
If ... it will be over.
Loop until j>= me.
Loop until xh = True.
r(i) = d
Next, I
Size b( 1 to 10)
For i = 1 to 10.
B(i) = application. Worksheet Function.Small(r, i)
Worksheet ("Lottery Plan"). Label 1。 Title = ""
then
For j = 1 to 10.
For i = 1 to 2000
If my Mod 100 = 0, then
Multiple activities
If ... it will be over.
m = Int((T2-t 1+ 1)* Rnd+t 1)
Worksheet ("lottery plan") label2.caption = format (m, "00000")
Next, I
d = b(j)
Worksheet ("lottery plan") label2.caption = format (d, "00000")
Worksheet ("Lottery Plan"). Label 1. Title = worksheet ("lottery plan"). Label 1. Title &; "& sheet ("lottery plan ") tab 2. title
Next J.
Nn = tj ("statistics")
Using Worksheets ("Statistics")
. Cell (nn+1, 1). Value = nn
. Cell (nn+1, 2). Value = date
. Cell (nn+ 1, 3). Value = worksheet ("lottery plan"). Label 1。 title
End with ...
For i = 1 to 14.
j = nn + 2 - i
If j> then 1
Using Worksheets ("Statistics")
a =。 Cell (nn+2-i, 2). value
c =。 Cell (nn+2-i, 3). value
End with ...
With worksheet ("lottery program")
. Cell (i+1, 14). Value = a
. Cell (i+1, 15). Value = c
End with ...
other
Quit for ...
If ... it will be over.
Next, I
End function
07
Click the button to test and get the random winning number.