VBA Mid Function – How to use Mid

Published by admin on

1. Mid VBA Function – Description

The MID VBA function is similar to the SUBSTRING or SUBSTR function in other programming languages. How does the MID function work? VBA MID extracts text from another text. For example, from the sentence “I’m learning programming in VBA” we can cut out the word “programming”. How to do it? The syntax of the function and its usage example are listed below.

2. VBA Mid Function – Syntax

Mid function syntax is listed below:

String – The text string from which we cut text.

Start – The next item in the text string from which we begin to cut text. The argument is a Long data type.

Length – Optional argument. We can specify in it how many characters from the string we want to cut. If you do not use the argument, you will return the entire string starting with the Start argument.

Function returns: String / text value

3. Mid VBA Example

Here is an example of using the MID function in the VisualBasic Editor.

VBA Functions - VBA Mid Function

VBA Functions – VBA Mid Function


Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: