VBA Instr Functions is one of the most used function while Automating. We need to extract the sub string from a lengthy string, particularly while dealing with strings. Let us see the Top most examples VBA Instr Function Examples with the VBA Code.
VBA Instr Function – Syntax and Examples
Let us understand the VBA Instr Function Syntax and its parameters first. And then let’s see the real-time examples on this function.
VBA Instr Function – Syntax
The main usage of the Instr Function is to extract a part of the string (sub-string) from a string. For example, if you have list of full names of employees in a worksheet and you want to extract the first name of the employee. You can use instr function and mid function to get the required part.
Below is the Syntax of VBA Instr Function:
InStr([Start], [String1], [String2], [Compare As])