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
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:
If Application.WorksheetFunction.IsText(Range("A1")) Then MsgBox "It's text" Else MsgBox "It's not text" End If
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."
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for