In this tutorial you will learn how to use the Split Function.
The Split Function returns a zero-based, one-dimensional array containing a specified number of substrings.
=Split(Expression As String, [Delimiter], [Limit As Long = -1], [Compare As VbCompareMethod = vbBinaryCompare])
string Required. String expression containing substrings and delimiters. If expression is a zero-length string(""), Split returns an empty array, that is, an array with no elements and no data..
[Delimiter] Optional. String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned..
[Limit] Optional. Number of substrings to be returned; –1 indicates that all substrings are returned..
[Compare] Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values..
In this example we will work with is "Alex,Jon,Rick".
The result is "Alex" "Jon" "Rick".
This will keep any spaces surrounding the names, so you could use the Trim function to get rid of these.
The Settings are:
Performs a comparison using the setting of the Option Compare statement.
Performs a binary comparison.
Performs a textual comparison.
Performs a comparison based on information in your database. (Microsoft Office Access 2007 only.)
In a Form you could set the Default Value of a Textbox to
In a Form add a TEXTBOX control and rename it "txtSplit", then you could add the following in the Load Event.
Private Sub Form_Load()
txtSplit = Split("Alex,Jon,Rick", ",")
Want to learn more? Request this via the contact form.
You can find more about this by searching the website.