1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)

Problemstellung:

Für 32Bit und 64Bit Office Versionen

Wie kann ich eine Zufallszahl erzeugen? 

Function ZufallszahlAusgeben(lngUntergrenze As Long, lngObergrenze As Long)
    
  Randomize Timer
  ZufallszahlAusgeben = Int((lngObergrenze - lngUntergrenze + 1) _
                               * Rnd + lngUntergrenze)
End Function

Aufruf:

Dim x As Long
x = ZufallszahlAusgeben(1, 100)

x würde ein Zufallszahl zwischen 1 und 100 annehmen.

 

Ähnliche Artikel