This is a text and video example of how to write a VBA Mid function:
********************************************************************
Public Sub GetMiddleName() Dim strMiddleName As String strMiddleName = Range("A2") strMiddleName = Mid(strMiddleName, 9, 3) Range("C2") = strMiddleName End Sub 'THE SECOND ARGUMENT OF THE VBA MID FUNCTION 'IS OPTIONAL 'SO YOU DON'T HAVE TO USE IT IF YOU DON'T WANT TO... 'THE FOLLOWING EXAMPLE EXCLUDES THE USE OF THE 'THIRD ARGUMENT... Public Sub GetLast4() Dim strTempText As String strTempText = Range("A1") strTempText = Mid(strTempText, 7) Range("B1") = strTempText End Sub
*****************************************************************
Now watch how it’s done…
Let me know if you have any questions
[simple_contact_form]
****************************************************
|