The VBA instr function allows you to search a target string to see if the string contains a specific search string.
You can use this for a basic test on email addresses: Dim Email As String, dim Location As Integer, email "m location InStr(Email, if Location 0 Then, msgBox "Not a valid email address".
Lots more free online course here on our main Home and Learn site All course material copyright Ken Carney.InStr function: the text to search, and what you want to find.How the to access VBA functions and commands.You need at least two items between the round brackets of the.The VBA Select Case Statement is an important construct in the VBA language.StrReverse This one is quite easy to use.
InStr searches from the beginning of your string.
For training on how to implement and use other advanced VBA functions within Excel, the ultimate excel VBA course will teach you how to harness the power 3ds max windows 8 crack of VBA within your own spreadsheets).
This will open the editor.Result: 9 'Shows that search is case-sensitive.The compare parameter is optional and can be used to specify how the strings will be compared.The string 2 parameter indicates the string to be searched for and must be specified.If the string is found then you get the location of the start of the string you were search for.This is what your initial spreadsheet should look like: For the tutorial, let us assume we want to ensure that all of the data we have entered into the email field is valid.To get the most out of this tutorial, it is highly advisable that you have completed a course like.VBA will then give you an Integer back in return.