Description:
Split() Function returns one dimensional array containing the substrings, after splitting the main string based upon the delimiter provided.
Format:
Split(strMainString [, delimiter[,intlimit[, vbCompare]]])
Arguments:
- strMainString
- Mandatory
- Type: String
- String which will be split
- delimiter
- Optional
- Type: Any
- The expression based on which the strMainString will get split
- intLimit
- Optional
- Type : Numeric
- No of substring to be returned.
- Compare
- Optional
- Type: Numeric
- The type of comparison to find the string in the main string, like vbBinaryCompare ( Value =0), vbTextCompare (value=1).
Example :
Function FnSplit() Dim strMainString Dim strTemp strMainString = "This is Split Function Example" arrSplit = Split(strMainString, " ") For i = 0 To UBound(arrSplit) strTemp = strTemp & arrSplit(i) & " " & vbCrLf Next MsgBox strTemp End Function
good tutorial and example
Thanks Santosh.
it is very helpful to learn vba.
Thank u so much sumit ji…
Thanks a lot Pankaj 🙂