Sub
CommandButton2_Click()
Dim
z1
As
Long
, z2
As
Long
, s2
As
Long
Randomize Timer
Set
Quelle = Sheets(
"FCLM_Data"
)
Set
ziel = Sheets(
"Board"
)
z2 = 9: s2 = 3: z3 = 9: s3 = 12: z4 = 13: s4 = 12
Set
ZielbereichY = ziel.Range(
"L9:Q9"
)
For
z1 = 1
To
Quelle.Cells(Rows.Count, 1).
End
(xlUp).Row
If
s2 > 10
Then
s2 = 3
z2 = z2 + 2
End
If
If
s4 > 18
Then
s4 = 12
z4 = z4 + 2
End
If
If
Quelle.Cells(z1, 1) <>
""
Then
If
Quelle.Cells(z1, 13) =
"y"
And
y < 6
Then
Do
s3 = Int(Rnd * (18 - 12 + 1)) + 12
z3 = Int(Rnd * (11 - 9 + 1)) + 9
Loop
Until
z3 <> 10
And
ziel.Cells(z3, s3) =
""
ziel.Cells(z3, s3) = Quelle.Cells(z1, 1)
y = y + 1
ElseIf
Quelle.Cells(z1, 13) =
"p"
And
p < 2
Then
ziel.Cells(z4, s4) = Quelle.Cells(z1, 1)
s4 = s4 + 1
p = p + 1
Else
ziel.Cells(z2, s2) = Quelle.Cells(z1, 1)
s2 = s2 + 1
End
If
End
If
Next
z1
End
Sub