Returns the numbers contained in a string as a numeric value of appropriate type.
The required string argument is any valid string expression.
The Val function stops reading the string at the first character it can’t recognize as part of a number. Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized. However, the function recognizes the radix prefixes &O (for octal) and &H (for hexadecimal). Blanks, tabs, and linefeed characters are stripped from the argument.
Returns a number rounded to a specified number of decimal places.
The Round function syntax has these parts:
|expression||Required. Numeric expression being rounded.|
|numdecimalplaces||Optional. Number indicating how many places to the right of the decimal are included in the rounding. If omitted, integers are returned by the Round function.|
Text1.Text = Number
Round(Number,5) ‘Rounds the number in text1 to 5 decimal places
Int and Fix functions
Returns the integer portion of a number.
The required number argument is a Double or any valid numeric expression. If number contains Null, Null is returned.
Both Int and Fix remove the fractional part of number and return the resulting integer value. The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example,Int converts -8.4 to -9, and Fix converts -8.4 to -8.
Rnd and Randomize functions
A function which generates a random number.
Randomize uses number to initialize the Rnd function’s random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.
Label1 = Int((6 * Rnd) + 1) ‘Generate random value between 1 and 6.
Returns a Variant (Integer) indicating the sign of a number.
The required number argument can be any valid numeric expression.