Rnd function

Category: Math

Summary

Pseudo-random number.

Syntax

Returns a Single containing a pseudo-random number.

Example

Example
This example uses the Rnd function to generate a random integer value from 1 to 6.
Dim MyValue As Integer
MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/rnd-function

Back to Functions