WorksheetFunction.RandBetween Method (Excel)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.

expression .RandBetween(Arg1, Arg2)

expression A variable that represents a WorksheetFunction object.

Parameters

Name

Required/Optional

Data Type

Description

Arg1

Required

Variant

Bottom - the smallest integer RANDBETWEEN will return.

Arg2

Required

Variant

Top - the largest integer RANDBETWEEN will return.

Return Value

Double

Show: