How to Use Istext in VBA

Written by bobson st. pierre
  • Share
  • Tweet
  • Share
  • Email

VBA is the underlying Macro programming language used in many Microsoft products, including Microsoft Office. VBA is used to enhance, automate or customise those programs. The language is easier to learn than traditional languages. VBA, like other programming languages, contains a number of functions you can use to work with text in your programs. The Istext function is one such function you can use to validate a field for text value. Using the Istext function is simple and takes just a few steps to follow.

Skill level:
Moderately Easy

Other People Are Reading


  1. 1

    Open Microsoft Excel.

  2. 2

    Place some text in cell "A1" in your Excel worksheet.

  3. 3

    Click "Tools," "Macro," then click "Visual Basic." This will open the VBA editor.

  4. 4

    Click "Insert," then "Module." You should now have a blank code module.

  5. 5

    Type or copy and paste the following code into the code module:

    Sub Check_For_Text()

    If Application.WorksheetFunction.IsText(Range("A1")) Then
    MsgBox "It's text"
    MsgBox "It's not text"
    End If

    End Sub

  6. 6

    Press "F5" to run the program. The code will check cell range A1 in your worksheet for a text value. If text is in the cell, a message will say "It's text." If not, a message will say "It's not text."

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.