View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected][_2_] no.reply7@comcast.net[_2_] is offline
external usenet poster
 
Posts: 6
Default Do without loop when using query

I'm stuck:

the following sample code works

----------------------
i = 0
Do Until i = 5
ActiveCell.Offset(0, i) = i
i = i + 1
Loop
-------------------------

Now, the following doesn't and returns a "Do without Loop" error
message

-----------------------
i = 0
Do Until i = 5
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;http://table.finance.yahoo.com/table.csv?s=" & ticker &
i & "&g=d&ignore=.csv", _
Destination:=ActiveCell)
.TextFileCommaDelimiter = True
.TextFileColumnDataTypes = Array(1, 9, 9, 9, 9, 9, 1)
.Refresh BackgroundQuery:=False
ActiveCell.Offset(0, 2).Select
Loop
-----------------------

I've tried with a for/next statement with the same issue.

Any ideas?