ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Splitting (https://www.excelbanter.com/new-users-excel/207012-splitting.html)

Tree*Rat

Splitting
 
how do i get VBA to split items that are seperated by a colon ;

ie this;that;andmore

split into vars

var1 = this
var2 = that
var3 = andmore

Idealy I it would be split into an array

Bob Phillips[_3_]

Splitting
 
The clue is in the subject

myVar = Split(the_text,";")

myVar is then a variant array.

--
__________________________________
HTH

Bob

"Tree*Rat" wrote in message
6.253...
how do i get VBA to split items that are seperated by a colon ;

ie this;that;andmore

split into vars

var1 = this
var2 = that
var3 = andmore

Idealy I it would be split into an array




Rick Rothstein

Splitting
 
To follow up on Bob's post... you can also declare a dynamic String variable
and assign the Split values to that instead.

Dim MyStringArray() As String
MyStringArray = Split(YourTextString, ";")

Note that all arrays created by the Split function are **always** zero-based
arrays (even if you use Option Base 1 in your code modules).

--
Rick (MVP - Excel)


"Bob Phillips" wrote in message
...
The clue is in the subject

myVar = Split(the_text,";")

myVar is then a variant array.

--
__________________________________
HTH

Bob

"Tree*Rat" wrote in message
6.253...
how do i get VBA to split items that are seperated by a colon ;

ie this;that;andmore

split into vars

var1 = this
var2 = that
var3 = andmore

Idealy I it would be split into an array





Tree*Rat

Splitting
 
"Rick Rothstein" wrote in
:

To follow up on Bob's post... you can also declare a dynamic String
variable and assign the Split values to that instead.

Dim MyStringArray() As String
MyStringArray = Split(YourTextString, ";")

Note that all arrays created by the Split function are **always**
zero-based arrays (even if you use Option Base 1 in your code
modules).


cool, thanks


All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com