LBound is the least length a string can have (0) and the UBound returns the length of the string. Here we have used a For loop where LBound and UBound set the range. ![]() Then applied the SPLIT function to the string using that variable and stored it in variable Result. We have set the string We are learning VBA SPLIT in one of the variables (TextString). Then declared three variables using the Dim keyword. Here we set the name of the macro as WordSeperator. Write the code at the Microsoft Visual Basic for Applications (You will find it under the Developer tab or can use the ALT + L + V shortcut to open the window) Sub WordSeparator()įor i = LBound(Result()) To UBound(Result())ĭisplayText = DisplayText & Result(i) & vbNewLine To split the string we will use the code written below. Split Words from StringĪs per the description of the function, you have understood that the SPLIT function will split the string into substrings. Numeric value to indicate what type of comparison to use when evaluating substringsĢ. The character that divides the string into parts The string to split based on the delimiter
0 Comments
Leave a Reply. |