Private Sub CommandButton1_Click()
For i = Range("AG6") To Range("AG7")
Range("AG5") = i
Do
[L11:Z11] = 0
For Each cel In [L11:Z11]
cel.Value = Int(Rnd() * 60 - 20)
If [AD11] < 0.87 Then GoTo a
Next
a:
Loop While [AD11] < 0.87
ActiveSheet.PageSetup.PrintArea = "A1:AD20"
ActiveSheet.PrintOut
Next
Private Sub CommandButton1_Click()
For i = Range("AG6") To Range("AG7")
Range("AG5") = i
Do
[O18:Z19] = 0 And [O21:Z22] = 0
For Each cel In [O18:Z19]
cel.Value = Int(Rnd() * 30)
If [AD20] < 0.87 Then GoTo a
Next
a:
Loop While [AD20] < 0.87
Next
For Each cel In [O21:Z22]
cel.Value = Int(Rnd() * 30)
If [AD20] < 0.87 Then GoTo a
Next
a:
Loop While [AD20] < 0.87
ActiveSheet.PageSetup.PrintArea = "A1:AE30"
ActiveSheet.PrintOut
Next