`Beispiel: VBA - Excel - Lottozahlen (Zufallszahlen) per Zufall bilden
Transcrição
`Beispiel: VBA - Excel - Lottozahlen (Zufallszahlen) per Zufall bilden
'Beispiel: VBA - Excel - Lottozahlen (Zufallszahlen) per Zufall bilden. 1 'Fügen Sie folgenden Text in ein Modul ein, und belegen Sie einen Button mit 'dem Prozeduraufruf ' ' Private Sub CommandButton1_Click() Call Lottozahlen End Sub Private Sub Lottozahlen() Dim Result As Integer Dim r1 As Range Dim OutPutRegion As Range Set OutPutRegion = Range("A1:H6") Rnd OutPutRegion.ClearContents For Each r1 In OutPutRegion.Cells Result = Int(49 * Rnd) + 1 Do Until WorksheetFunction.CountIf(OutPutRegion, Result) = 0 Result = Int(49 * Rnd) + 1 Loop r1.Value = Result r1.Font.Italic = True r1.Font.Bold = False Next End Sub Download from: Server: http://www.visual-basic5.de http://vbclassic.piranho.com all rights reserved by [ prelles basics – germany – heinz prelle - 30655 hannover ] – www.visual-basic5.de