Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

VBA - Randomize/Rnd issue with whole numbers.

$
0
0
I'm having trouble getting a random number procedure to work in that I want it to display a random number between two numbers with the output displaying two decimal points. Such as:

Range: 7.35 - 7.45.

I've tried a couple of things like:

Code:

Int((Upperbound - Lowerbound + 1) * Rnd + Lowerbound)
, replacing the +1 with, say, .01, .1, 0.1, etc.

The issue is it always displays a whole number without decimals. Even if I have the textbox set to display 2 decimal points and a standard number it displays 7.00, 6.00, etc.

What am I doing wrong?

Thank you!

Viewing all articles
Browse latest Browse all 13329

Trending Articles