View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Convert String of 512 numbers to a range

Just a different idea using text to columns. It splits the string onto
A1:A2, then uses text to column.

Sub Demo()
'// Dana DeLouis
Dim s As String
Dim half As Long
Dim v As Variant

s = [A1]
half = ((Len(s) - Len(Replace(s, ",", vbNullString))) \ 2) + 1
[A1:A2].NumberFormat = "@"
v = Split(Replace(Replace(s, ",", ";", 1, half), ";", ",", 1, half - 1),
";")
[A1] = v(0)
[A2] = v(1)

Range("A1:A2").TextToColumns _
Destination:=Range("A1"), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=False, _
Comma:=True, _
Space:=False, _
Other:=False

End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Kevin G" wrote in message
news:v0ZRb.29750$A7.8532@edtnps84...
Hello,

How would I convert a single cell string consiting of 512 values: 545,

565,
576, etc... to a range of 512 cells.

Thanks, Kevin Graham