Private Sub CommandButton1_Click()
Dim rg As Range
For i = Range("AG6") To Range("AG7")
Range("AG5") = i
Do
[O18:X19,O26:X27].ClearContents
For Each rg In Range("O18:X19,O26:X27")
rg.Value = Int(Rnd() * 40 - 20)
Next
Loop Until (Range("AA18").Value > 0.85 And Range("AA26").Value > 0.85)
ActiveSheet.PageSetup.PrintArea = "A1:AF33"
ActiveSheet.PrintOut
Next
End Sub
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
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