Val Function

рд╕реНрдЯреНрд░рд┐рдВрдЧ рдХреЛ рдиреНрдпреВрдореЗрд░рд┐рдХ рдПрдХреНрд╕рдкреНрд░реЗрд╢рди рдореЗрдВ рдкрд░рд┐рд╡рд░реНрддрд┐рдд рдХрд░рддрд╛ рд╣реИ.

Syntax:


Dim stext As String

рд╡рд╛рдкрд╕реА рдореВрд▓реНрдп:

рджреЛрдЧреБрдирд╛

рдкреИрд░рд╛рдореАрдЯрд░

Text: String that represents a number.

Using the Val function, you can convert a string that represents numbers into numeric expressions. This is the inverse of the Str function. If only part of the string contains numbers, only the first appropriate characters of the string are converted. If the string does not contain any numbers, the Val function returns the value 0.

Error codes:

5 Invalid procedure call

рдЙрджрд╛рд╣рд░рдг:


Sub ExampleVal
    MsgBox Val("123.123")
    MsgBox Val("A123.123")
End Sub