Private Sub CommandButton1_Click()
Dim T#, F, C&, Tlaps#, a&, VaL
Randomize
Set F = ActiveSheet
Tlaps = 0.3
VaL = Array(xlBottom, xlCenter, xlTop)
F.Cells(2, 1).Resize(, 7).ClearContents
For C = 1 To 7
T = Timer + Tlaps
Do
DoEvents
F.Cells(2, C).Resize(, 7 - (C - 1)) = Round(1 + (Rnd * 49))
For a = 0 To 3: DoEvents: F.Cells(2, C).Resize(, 7 - (C - 1)).VerticalAlignment = VaL(IIf(a = 3, 0, a)): Next
F.Cells(2, C) = Round(1 + (Rnd * 49))
If Timer > T Then
If C = 1 And Timer + Tlaps > T Then F.Cells(2, C).VerticalAlignment = xlCenter: Exit Do
If C > 1 Then
If WorksheetFunction.CountIf(F.Range(F.Cells(2, 1), F.Cells(2, C)), F.Cells(2, C)) > 1 Then
T = Timer + Tlaps
Else
F.Cells(2, C).VerticalAlignment = xlCenter: Exit Do
End If
End If
End If
Loop
Next
End Sub