ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Web Query address parameter (https://www.excelbanter.com/excel-programming/280218-web-query-address-parameter.html)

buckle

Web Query address parameter
 
I've created a Web Query that retrieves information about a certain stock.
Instead of modifying a parameter in the web query address when I want to
select a different stock, is there a way to insert the text from a cell on
the spreadsheet?

example: http://www.finance.yahoo.com/q?s=ibm gets me IBM. Can the parameter
"IBM" get input by the user or selected from a cell (say +a10)?

Thanks



Haldun Alay[_3_]

Web Query address parameter
 
Hi,

Put the following code worksheet's (where A10 is) WORKSHEET_CHANGE event
Assumed your Web Query in sheet1


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count = 1 And Target.Row = 1 And Target.Column = 10 Then
Sheet1.QueryTables(1).Connection =
"URL;http://finance.yahoo.com/q?s=" + Target.Value
Sheet1.QueryTables(1).Refresh
End If

End Sub

--
Regards

Haldun Alay

To e-mail me, please remove AT and DOT from my e-mail address.



"buckle" , iletide şunu yazdı
...
I've created a Web Query that retrieves information about a certain stock.
Instead of modifying a parameter in the web query address when I want to
select a different stock, is there a way to insert the text from a cell on
the spreadsheet?

example: http://www.finance.yahoo.com/q?s=ibm gets me IBM. Can the

parameter
"IBM" get input by the user or selected from a cell (say +a10)?

Thanks





buckle

Web Query address parameter
 
Hi Haldun,

I'm getting a value error with your sample. Is the Target.value returning a
value or string?

Just starting to learn VBE stuff, so I'm a little green.

Thanks

"Haldun Alay" <haldunalayATyahooDOTcom wrote in message
...
Hi,

Put the following code worksheet's (where A10 is) WORKSHEET_CHANGE event
Assumed your Web Query in sheet1


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count = 1 And Target.Row = 1 And Target.Column = 10 Then
Sheet1.QueryTables(1).Connection =
"URL;http://finance.yahoo.com/q?s=" + Target.Value
Sheet1.QueryTables(1).Refresh
End If

End Sub

--
Regards

Haldun Alay

To e-mail me, please remove AT and DOT from my e-mail address.



"buckle" , iletide şunu yazdı
...
I've created a Web Query that retrieves information about a certain

stock.
Instead of modifying a parameter in the web query address when I want to
select a different stock, is there a way to insert the text from a cell

on
the spreadsheet?

example: http://www.finance.yahoo.com/q?s=ibm gets me IBM. Can the

parameter
"IBM" get input by the user or selected from a cell (say +a10)?

Thanks








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

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