View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Mike[_37_] Mike[_37_] is offline
external usenet poster
 
Posts: 20
Default Convert String of 512 numbers to a range

If it's not something that has to be in a macro, what about Data: Text to
Columns:... ? or if it's in a macro, use range.TextToColumns

Although the whole "columns max out at 256" will require a solution.

but you could always use range.texttocolumns with fixed width, split the
cell into 2 or 4 or something, copy the chunks you've split off into the
next row (range.offset(1,0)=range.offset(0,1),
range.offset(2,0)=range.offset(0,2) etc) then use range.texttocolumns on
each of your new cells.


--

__________________________________________________ __________________________
________________
Please reply to newsgroup so everyone can benefit.
Email address is not valid (see sparkingwire.com)
__________________________________________________ __________________________
________________
"Kevin G" wrote in message
news:AJ9Sb.38990$oj2.26828@edtnps89...
How about transposing this.

"Rob van Gelder" wrote in message
...
Kevin,

This converts to rows as columns max out at 256
First bit puts a string together, second bit strips it apart.

Sub test()
Const cSeparator = ","
Dim str512 As String, i As Long, j As Long

'build it
str512 = ""
For i = 0 To 512 - 1
str512 = str512 & IIf(str512 = "", "", cSepChar & " ") &

Int(Rnd()
*
900 + 100)
Next

'strip it
With Sheet1
i = 1: j = InStr(1, str512, cSeparator)
Do Until j = 0
.Cells(i, 1) = Trim(Mid(str512, 1, j - 1))
str512 = Mid(str512, j + Len(cSeparator))
i = i + 1
j = InStr(1, str512, cSeparator)
Loop
If Len(Trim(str512)) 0 Then Cells(i, 1) = Trim(str512)
End With
End Sub


Rob


"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