[RESOLVED] Rounding (Simple question)
Hi all,
I'm trying to make a program generate a random number and then output it. The only problem is, the number needs to be fairly big, so an Integer doesn't work (it creates overflows). I can use a double, but then it outputs a long line of numbers after the decimal point. How can I make it round the number?
Code:
Private Sub GenRan_Click()
Dim RI As Double
Dim GN As Double
If RanIn.Text = "" Then
MsgBox "You must enter a value!", vbExclamation, "Error"
Exit Sub
End If
Randomize
RI = RanIn.Text
GN = RI * Rnd
MsgBox GN, vbInformation, "Your number is..."
End Sub
Thanks all :)
Re: Rounding (Simple question)
Round(Number,Number of values after decimal point)
Or you can use the long variable type
Re: Rounding (Simple question)
Splendid! Thank you very much. How high can "long" go up to?
Re: [RESOLVED] Rounding (Simple question)
-2,147,483,648 to 2,147,483,647, or 4 bytes