How to Use Istext in VBA

Updated July 20, 2017

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.

Open Microsoft Excel.

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

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

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

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

Sub Check_For_Text()

End Sub

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."

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Bobson St. Pierre started writing professionally in 2007 as a copywriter for his Web design firm, Bobson Consulting Corp. He keeps a blog and has written an e-book titled, "Fail your way to success!" St. Pierre holds a Bachelor of Science in computer science from DeVry University in North Brunswick, N.J.