VBA Check if a Cell Contains a Letter or String

In this lesson, I’ll show you how to create a VBA macro to check whether the string contains a letter or a string.

This simple procedure uses the InStr function to return the first occurrence of a letter or a string in an active cell. In other words, if there is a substring inside, the number can’t be lower than 1, therefore if the InStr returns a value larger than 0, it means that a string or a character is inside, and the Sub displays a message box informing you about this.

If the cell is empty or it doesn’t contain the value it will display MsgBox informing you about this.

What you have to remember, is that the second argument in the InStr function is case-sensitive.

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.