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.
Thanks in advance
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])