Module
Contents
Index 🔎︎
\<bookmark_value\>Val function\</bookmark_value\>

# Val Function

Converts a string to a numeric expression.

## Syntax:

    Val (Text As String)

## Return value:

Double

## Parameters:

\<emph\>Text:\</emph\> 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 \<emph\>Str\</emph\> 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 \<emph\>Val\</emph\> function returns the value 0.

## Error codes:

5 Invalid procedure call

## Example:

    Sub ExampleVal

        MsgBox Val("123.123")

        MsgBox Val("A123.123")

    End Sub