Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Duane L Kibby
 
Posts: n/a
Default .csv file Text to Columns

Hi,
The stock data ".csv" file downloaded from the internet displays the seven
comma delimited items all in one column.

2.91,200730,2.63,3.34,3.00,2.91,3.05
22.70,362487,22.65,24.19,22.06,21.91,22.83
13.28,115617,12.42,15.90,13.93,13.10,14.00

The code segment: (excel 2000)

Set AllStockDataWorksheet = Workbooks(1).Worksheets(4)
Set AllStockDataResults = AllStockDataWorksheet.QueryTables _
.Add(Connection:="URL;http://finance.yahoo.com/d/quotes.csv?s=" &
Left ( SymbolString, Len(SymbolString) - 1) & "&f=l1va2c1&e=.csv", _
Destination:=AllStockDataWorksheet.Cells(RowNumber , 4))


With AllStockDataResults
.Refresh (BackgroundQuery)
End With

For some reason the data is not distrubuted across the columns, but is all
piles in one. I can do manually, but I need it to be programmatically.

Thanks Duane
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Duane,

Try adding these lines to the end of your code:

With AllStockDataWorksheet
.Range(.Cells(rownumber, 4), .Cells(rownumber, 4).End(xlDown)) _
.TextToColumns DataType:=xlDelimited, Comma:=True
End With

HTH,
Bernie
MS Excel MVP



"Duane L Kibby" wrote in message
...
Hi,
The stock data ".csv" file downloaded from the internet displays the seven
comma delimited items all in one column.

2.91,200730,2.63,3.34,3.00,2.91,3.05
22.70,362487,22.65,24.19,22.06,21.91,22.83
13.28,115617,12.42,15.90,13.93,13.10,14.00

The code segment: (excel 2000)

Set AllStockDataWorksheet = Workbooks(1).Worksheets(4)
Set AllStockDataResults = AllStockDataWorksheet.QueryTables _
.Add(Connection:="URL;http://finance.yahoo.com/d/quotes.csv?s=" &
Left ( SymbolString, Len(SymbolString) - 1) & "&f=l1va2c1&e=.csv", _
Destination:=AllStockDataWorksheet.Cells(RowNumber , 4))


With AllStockDataResults
.Refresh (BackgroundQuery)
End With

For some reason the data is not distrubuted across the columns, but is all
piles in one. I can do manually, but I need it to be programmatically.

Thanks Duane



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a text file ? WTG Excel Worksheet Functions 2 February 22nd 05 01:29 AM
can i save an existing .xls file as a .csv file using command line craigkan Excel Discussion (Misc queries) 2 February 18th 05 02:01 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Text To Columns Mike Excel Worksheet Functions 3 December 31st 04 11:22 PM
How do I compare two columns on seperate sheets and replace text . hag400 Excel Worksheet Functions 1 December 28th 04 02:32 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"