ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing a string as columns. (https://www.excelbanter.com/excel-programming/428192-re-importing-string-columns.html)

Peter T

Importing a string as columns.
 
Assuming the separator is (say) a comma (not as your sample which includes
commas & spaces)

Sub Test()
Dim i As Long
Dim sData As String
Dim arr
For i = 1 To 1 ' some loop to get the string
sData = "52014,1868,6169,1259,133878,88,4544190,93464, 88"
arr = Split(sData, ",")
Cells(i, 1).Resize(, UBound(arr)).Value = arr
Next
End Sub

Regards,
Peter T


"Darren" wrote in message
...
Using a data connection, I get the following string:
52014,1868,61691259 133878,88,4544190 93464,88,4466101 194208,89,4851141
164320,89,4972916 234386,80,2033390 119520,70,756142 196767,82,2477652
102349,89,5179496 138197,86,3669161 186012,85,3352716 224651,77,1599646
7666,99,13271321 53994,76,1385884 88911,71,828589 94489,77,1483429
72524,67,580513 25455,75,1215975 62641,71,830699 90562,75,1231729
65625,68,607909 31582,73,999948 180230,64,433406 96940,61,305742
64779,68,613564 -1,-1 -1,-1 -1,-1 -1,-1.
At the moment I extract 90 such strings and have written a macro to
separate
each string into columns. Having it done as I open the sheet would make it
so
much easier for me.
Is there a way to display the string as columns directly from the download
without going through 'text to columns, select delimiter, do not download
column'?





All times are GMT +1. The time now is 05:23 PM.

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