Skip to main content

WorksheetFunction.IsText method

Checks the type of value and returns True or False depending on whether the value refers to text.

Syntax

expression.IsText (Arg1)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 Required Variant Value - the value that you want tested. Value can be a blank (empty cell), error, logical, text, number, or reference value, or a name referring to any of these, that you want to test.

Return value

Boolean

Remarks

The value arguments of the IS functions are not converted. For example, in most other functions where a number is required, the text value 19 is converted to the number 19. However, in the formula ISNUMBER("19"), 19 is not converted from a text value, and the IsNumber function returns False.

The IS functions are useful in formulas for testing the outcome of a calculation. When combined with the IF function, they provide a method for locating errors in formulas.

Examples

The following example illustrates the use of the IsText method:

Sub RomanToArabic()
    Dim rng As Range
    On Error Resume Next
    Selection.Value = Selection.Value
    For Each rng In Selection
        If WorksheetFunction.IsText(rng) Then
            rng.Value = WorksheetFunction.Arabic(rng)
        End If
    Next rng
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>