ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Convert a string to an array (https://www.excelbanter.com/excel-programming/278255-re-convert-string-array.html)

don

Convert a string to an array
 
' Parse the comma separated string in the current cell into an array

Dim strArray As Variant
Dim intIndex As Integer

strArray = Split(ActiveCell.Value, ",")

If UBound(strArray) < 0 Then
Debug.Print "No string tokens found"
Else
For intIndex = 0 To UBound(strArray)
Debug.Print "Token(" & intIndex & ") = " & strArray(intIndex)
Next intIndex
End If

"pk" wrote in message
...
Does anyone know an easy/efficient method for converting a
comma separated string into a single column array?

i.e. string is passed in this format:

item1,item2,item3,itemx...

I need to parse and copy into an array.

Your example code would be greatly appreciated...thanks in
advance.





All times are GMT +1. The time now is 04:34 AM.

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