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.
50+ Project Management Templates Pack
Excel PowerPoint Word
Advanced Project Plan & Portfolio Template
Business Presentations Templates Pack
20+ Excel Project Management Pack
20+ PowerPoint Project Management Pack
10+ MS Word Project Management Pack
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])