csv querytable.add question

PKiss

New Member
Joined
Sep 22, 2011
Messages
34
I am trying to write a function that pulls off a single value from a web query of a csv.
The functions purpose is to have the argument be the stock ticker. I got it to work fine if i place the destination range as somewhere else on the sheet. What would i have to write in the destination field in order for the value to appear in the same cell as the function. Sorry if this is a simple request. I guess im mentally fatigued today.
Code:
Function LastPrice(strTicker As String) As Range

Dim url As String
url = "URL;http://finance.yahoo.com/d/quotes.csv?s=" & strTicker & "&f=l1"

With Worksheets("Sheet1").QueryTables.Add(Connection:=url, Destination:=[COLOR=Red]Worksheets("Sheet1").Range("A1")[/COLOR])
Thanks in advance
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top