VB and VBA Users Source Code: Generate a random number
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Generate a random number
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Monday, September 17, 2001
Hits:
809
Category:
Visual Basic General
Article:
The following function generates a random whole number between a specified range. 'Purpose : Returns a random number between a specified range. 'Inputs : lMinValue The smallest value the number can be. ' lMaxValue The largest value the number can be. 'Outputs : Returns a random number. 'Author : Andrew Baker 'Date : 19/Sep/2001 15:50 'Notes : 'Revisions : 'Assumptions : Function RandomNumber(lMinValue As Long, lMaxValue As Long) As Long Randomize 'Uses system timer to seed the Rnd function RandomNumber = (lMaxValue - lMinValue) * Rnd + lMinValue End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder